MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:<gshchepa Date:February 27 2008 11:15am
Subject:bk commit into 5.0 tree (gshchepa:1.2607) BUG#34620
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gshchepa.  When gshchepa does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-02-27 15:15:09+04:00, gshchepa@stripped +3 -0
  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@stripped, 2008-02-27 14:54:59+04:00, gshchepa@stripped +9 -0
    Added test case for bug #34620.

  mysql-test/t/row.test@stripped, 2008-02-27 14:55:03+04:00, gshchepa@stripped +13 -0
    Added test case for bug #34620.

  sql/item.h@stripped, 2008-02-27 14:55:04+04:00, gshchepa@stripped +9 -0
    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.

diff -Nrup a/mysql-test/r/row.result b/mysql-test/r/row.result
--- a/mysql-test/r/row.result	2007-04-20 15:28:28 +05:00
+++ b/mysql-test/r/row.result	2008-02-27 14:54:59 +04:00
@@ -434,3 +434,12 @@ SELECT @x;
 @x
 99
 DROP TABLE t1;
+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;
+ROW(a, 1) IN (SELECT SUM(b), 1)
+1
+SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
+ROW(a, 1) IN (SELECT SUM(b), 3)
+0
+DROP TABLE t1;
diff -Nrup a/mysql-test/t/row.test b/mysql-test/t/row.test
--- a/mysql-test/t/row.test	2007-06-01 18:49:00 +05:00
+++ b/mysql-test/t/row.test	2008-02-27 14:55:03 +04:00
@@ -224,3 +224,16 @@ SET @x:= (SELECT h FROM t1 WHERE (a,b,c,
 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;
diff -Nrup a/sql/item.h b/sql/item.h
--- a/sql/item.h	2008-01-27 09:45:30 +04:00
+++ b/sql/item.h	2008-02-27 14:55:04 +04:00
@@ -1990,6 +1990,15 @@ public:
   Item_field *filed_for_view_update()
     { return (*ref)->filed_for_view_update(); }
   virtual Ref_Type ref_type() { return REF; }
+
+  // Row emulation: forwarding of ROW-related calls to ref
+  uint cols()                 { return (*ref)->cols(); }
+  Item* element_index(uint i) { return (*ref)->element_index(i); }
+  Item** addr(uint i)         { return (*ref)->addr(i); }
+  bool check_cols(uint c)     { return (*ref)->check_cols(c); }
+  bool null_inside()          { return (*ref)->null_inside(); }
+  void bring_value()          {        (*ref)->bring_value(); }
+
 };
 
 
Thread
bk commit into 5.0 tree (gshchepa:1.2607) BUG#34620gshchepa27 Feb