Below is the list of changes that have just been committed into a local
4.1 repository of kaa. When kaa 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, 2007-11-07 18:45:04+03:00, kaa@polly.(none) +3 -0
Fix for bug #32103: optimizer crash when join on int and mediumint with
variable in where clause.
Problem: the new_item() method of Item_uint used an incorrect
constructor. "new Item_uint(name, max_length)" calls
Item_uint::Item_uint(const char *str_arg, uint length) which assumes the
first argument to be the string representation of the value, not the
item's name. This could result in either a server crash or incorrect
results depending on usage scenarios.
Fixed by using the correct constructor in new_item():
Item_uint::Item_uint(const char *str_arg, longlong i, uint length).
mysql-test/r/select.result@stripped, 2007-11-07 18:45:01+03:00, kaa@polly.(none) +8 -0
Added a test case for bug #32103.
mysql-test/t/select.test@stripped, 2007-11-07 18:45:01+03:00, kaa@polly.(none) +21 -0
Added a test case for bug #32103.
sql/item.h@stripped, 2007-11-07 18:45:01+03:00, kaa@polly.(none) +1 -1
Use the correct constructor for Item_uint in Item_uint::new_item().
diff -Nrup a/mysql-test/r/select.result b/mysql-test/r/select.result
--- a/mysql-test/r/select.result 2006-12-06 15:32:08 +03:00
+++ b/mysql-test/r/select.result 2007-11-07 18:45:01 +03:00
@@ -2835,4 +2835,12 @@ FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF
8FFFFFFFFFFFFFFF 7FFFFFFFFFFFFFFF
drop table t1;
+CREATE TABLE t1 (c0 int);
+CREATE TABLE t2 (c0 int);
+INSERT INTO t1 VALUES(@@connect_timeout);
+INSERT INTO t2 VALUES(@@connect_timeout);
+SELECT * FROM t1 JOIN t2 ON t1.c0 = t2.c0 WHERE (t1.c0 <=> @@connect_timeout);
+c0 c0
+X X
+DROP TABLE t1, t2;
End of 4.1 tests
diff -Nrup a/mysql-test/t/select.test b/mysql-test/t/select.test
--- a/mysql-test/t/select.test 2006-12-06 15:32:08 +03:00
+++ b/mysql-test/t/select.test 2007-11-07 18:45:01 +03:00
@@ -2353,4 +2353,25 @@ insert into t1 values (0xfffffffffffffff
select hex(a), hex(b) from t1;
drop table t1;
+#
+# Bug #32103: optimizer crash when join on int and mediumint with variable in
+# where clause
+#
+
+CREATE TABLE t1 (c0 int);
+CREATE TABLE t2 (c0 int);
+
+# We need any variable that:
+# 1. has integer type,
+# 2. can be used with the "@@name" syntax
+# 3. available in every server build
+INSERT INTO t1 VALUES(@@connect_timeout);
+INSERT INTO t2 VALUES(@@connect_timeout);
+
+# We only need to ensure 1 row is returned to validate the results
+--replace_column 1 X 2 X
+SELECT * FROM t1 JOIN t2 ON t1.c0 = t2.c0 WHERE (t1.c0 <=> @@connect_timeout);
+
+DROP TABLE t1, t2;
+
--echo End of 4.1 tests
diff -Nrup a/sql/item.h b/sql/item.h
--- a/sql/item.h 2007-01-26 05:44:32 +03:00
+++ b/sql/item.h 2007-11-07 18:45:01 +03:00
@@ -690,7 +690,7 @@ public:
double val()
{ DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); }
String *val_str(String*);
- Item *new_item() { return new Item_uint(name,max_length); }
+ Item *new_item() { return new Item_uint(name, value, max_length); }
int save_in_field(Field *field, bool no_conversions);
void print(String *str);
Item_num *neg ();
| Thread |
|---|
| • bk commit into 4.1 tree (kaa:1.2686) BUG#32103 | Alexey Kopytov | 7 Nov |