Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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
1.1999 05/09/27 23:13:11 evgen@stripped +3 -0
Fix bug#13356 resolve_const_item() wasn't able to handle Item_row items.
resolve_const_item() assumed to be not called for Item_row items. For
ensuring that DBUG_ASSERT(0) was set there.
This patch adds section for Item_row items. If it can it recursively calls
resolve_const_item() for each item the Item_row contains. If any of the
contained items is null then whole Item_row substitued by Item_null. Otherwise
it just returns.
mysql-test/r/select.result
1.95 05/09/27 23:12:51 evgen@stripped +9 -0
Test case for bug#13356 resolve_const_item() wasn't able to handle Item_row items.
mysql-test/t/select.test
1.80 05/09/27 23:12:42 evgen@stripped +10 -0
Test case for bug#13356 resolve_const_item() wasn't able to handle Item_row items.
sql/item.cc
1.180 05/09/27 23:12:14 evgen@stripped +33 -5
Fix bug#13356 resolve_const_item() wasn't able to handle Item_row items.
Added section to resolve_const_item() for Item_row items. If it can it
recursively calls resolve_const_item() for each item the Item_row contains. If
any of the contained items is null then Item_row is substituted by Item_null.
Otherwise it just returns.
Comment moved closer to function it belongs to.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: evgen
# Host: moonbone.local
# Root: /work/13356-bug-5.0-mysql
--- 1.179/sql/item.cc 2005-09-15 23:29:00 +04:00
+++ 1.180/sql/item.cc 2005-09-27 23:12:14 +04:00
@@ -5172,11 +5172,6 @@
}
-/*
- If item is a const function, calculate it and return a const item
- The original item is freed if not returned
-*/
-
Item_result item_cmp_type(Item_result a,Item_result b)
{
if (a == STRING_RESULT && b == STRING_RESULT)
@@ -5192,6 +5187,11 @@
}
+/*
+ If item is a const function, calculate it and return a const item
+ The original item is freed if not returned
+*/
+
void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
{
Item *item= *ref;
@@ -5248,6 +5248,34 @@
break;
}
case ROW_RESULT:
+ {
+ new_item= 0;
+ /*
+ If item and comp_item are both Item_rows and have same number of cols
+ then process items in Item_row one by one. If Item_row contain nulls
+ substitute it by Item_null. Otherwise just return.
+ */
+ if (item->result_type() == comp_item->result_type() &&
+ ((Item_row*)item)->cols() == ((Item_row*)comp_item)->cols())
+ {
+ Item_row *item_row= (Item_row*)item,*comp_item_row= (Item_row*)comp_item;
+ if (item_row->null_inside())
+ {
+ new_item= (Item*) new Item_null(name);
+ break;
+ }
+ int i= item_row->cols() - 1;
+ for (; i>=0; i--)
+ {
+ if (item_row->maybe_null && item_row->el(i)->is_null())
+ {
+ new_item= (Item*) new Item_null(name);
+ break;
+ }
+ resolve_const_item(thd, item_row->addr(i), comp_item_row->el(i));
+ }
+ break;
+ }
default:
DBUG_ASSERT(0);
}
--- 1.94/mysql-test/r/select.result 2005-09-20 15:00:35 +04:00
+++ 1.95/mysql-test/r/select.result 2005-09-27 23:12:51 +04:00
@@ -3029,3 +3029,12 @@
102
drop table t1, t2;
drop view v1, v2, v3;
+create table t1(f1 int, f2 int);
+create table t2(f3 int);
+select f1 from t1,t2 where f1=f2 and (f1,f2) in ((1,1));
+f1
+select f1 from t1,t2 where f1=f2 and (f1,NULL) in ((1,1));
+f1
+select f1 from t1,t2 where f1=f2 and (f1,f2) in ((1,NULL));
+f1
+drop table t1,t2;
--- 1.79/mysql-test/t/select.test 2005-09-20 15:00:35 +04:00
+++ 1.80/mysql-test/t/select.test 2005-09-27 23:12:42 +04:00
@@ -2565,3 +2565,13 @@
drop table t1, t2;
drop view v1, v2, v3;
+
+#
+# Bug #13356 assertion failed in resolve_const_item()
+#
+create table t1(f1 int, f2 int);
+create table t2(f3 int);
+select f1 from t1,t2 where f1=f2 and (f1,f2) in ((1,1));
+select f1 from t1,t2 where f1=f2 and (f1,NULL) in ((1,1));
+select f1 from t1,t2 where f1=f2 and (f1,f2) in ((1,NULL));
+drop table t1,t2;
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.1999) BUG#13356 | eugene | 27 Sep |