Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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-27 19:45:05+02:00, gkodinov@stripped +3 -0
Bug #31887: DML Select statement not returning same results
when executed in version 5
Zero fill is a field attribute only. So we can't propagate
constants for zerofill fields : the values and expression
results don't have that flag.
Fixed by disabling const propagation for fields with
ZEROFILL flag.
mysql-test/r/compare.result@stripped, 2007-11-27 19:45:04+02:00, gkodinov@stripped +11 -0
Bug #31887: test case
mysql-test/t/compare.test@stripped, 2007-11-27 19:45:04+02:00, gkodinov@stripped +16 -0
Bug #31887: test case
sql/item.cc@stripped, 2007-11-27 19:45:04+02:00, gkodinov@stripped +4 -3
Bug #31887: Don't replace fields with constants if
these fields have the zerofill flag on
diff -Nrup a/mysql-test/r/compare.result b/mysql-test/r/compare.result
--- a/mysql-test/r/compare.result 2006-11-28 15:43:57 +02:00
+++ b/mysql-test/r/compare.result 2007-11-27 19:45:04 +02:00
@@ -53,3 +53,14 @@ a b
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
drop table if exists t1;
+CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill);
+INSERT INTO t1 (b,c) VALUES (1,2), (1,1);
+SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1;
+CONCAT(b,c) CONCAT(b,c) = '0101'
+0102 0
+0101 1
+SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
+b c
+01 01
+DROP TABLE t1;
+End of 5.0 tests
diff -Nrup a/mysql-test/t/compare.test b/mysql-test/t/compare.test
--- a/mysql-test/t/compare.test 2006-08-15 10:13:11 +03:00
+++ b/mysql-test/t/compare.test 2007-11-27 19:45:04 +02:00
@@ -46,3 +46,19 @@ insert into t1 values (0x01,0x01);
select * from t1 where a=b;
select * from t1 where a=b and b=0x01;
drop table if exists t1;
+
+#
+# Bug #31887: DML Select statement not returning same results when executed
+# in version 5
+#
+
+CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill);
+INSERT INTO t1 (b,c) VALUES (1,2), (1,1);
+
+SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1;
+
+SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff -Nrup a/sql/item.cc b/sql/item.cc
--- a/sql/item.cc 2007-11-20 19:18:20 +02:00
+++ b/sql/item.cc 2007-11-27 19:45:04 +02:00
@@ -4058,8 +4058,8 @@ Item_equal *Item_field::find_item_equal(
'a'='a '
(LENGTH('a')=1) != (LENGTH('a ')=2)
Such a substitution is surely valid if either the substituted
- field is not of a STRING type or if it is an argument of
- a comparison predicate.
+ field is not of a STRING type, doesn't have the ZEROFILL flag on
+ or if it is an argument of a comparison predicate.
RETURN
TRUE substitution is valid
@@ -4068,7 +4068,8 @@ Item_equal *Item_field::find_item_equal(
bool Item_field::subst_argument_checker(byte **arg)
{
- return (result_type() != STRING_RESULT) || (*arg);
+ return (result_type() != STRING_RESULT && !(field->flags & ZEROFILL_FLAG))
+ || (*arg);
}
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2588) BUG#31887 | kgeorge | 27 Nov |