From d40ca16156641481abd45f93e31233044f4b9df6 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Feb 2008 22:53:31 +0400 Subject: Fixed bug #34620: item_row.cc:50: Item_row::illegal_method_call(const char*): Assertion `0' failed If ROW item is a part of an expression that also has aggregate function calls (COUNT/SUM/AVG...), a "splitting" with an Item::split_sum_func2 function is applied to that ROW item. Current implementation of Item::split_sum_func2 replaces this Item_row with a newly created Item_aggregate_ref reference to it. Then the row cache tries to work with the Item_aggregate_ref object as with the Item_row object: row cache calls row-emulation methods such as cols and element_index. Item_aggregate_ref (like it's parent Item_ref) inherits dummy implementations of those methods from the hierarchy root Item, and call to them leads to failed assertions and wrong data output. Row-emulation virtual functions (cols, element_index, addr, check_cols, null_inside and bring_value) of Item_ref have been overloaded to forward calls to an underlying item reference. mysql-test/r/row.result: Added test case for bug #34620. mysql-test/t/row.test: Added test case for bug #34620. sql/item.h: Fixed bug #34620. Row-emulation virtual functions (cols, element_index, addr, check_cols, null_inside and bring_value) of Item_ref have been overloaded to forward calls to an underlying item reference. --- mysql-test/t/row.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t/row.test') diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index 20d044306a6..1601f7afd0e 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -224,3 +224,16 @@ SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7)); SELECT @x; DROP TABLE t1; + +# +# Bug #34620: item_row.cc:50: Item_row::illegal_method_call(const char*): +# Assertion `0' failed +# + +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1); + +SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a; +SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a; + +DROP TABLE t1; -- cgit v1.2.1