Below is the list of changes that have just been committed into a local
5.1 repository of ram. When ram 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-05-29 16:24:12+05:00, ramil@stripped +4 -0
Fix for bug #28631: Bit index creation failure after alter
Problem: altering a bit field we use Field::is_equal() to check if the bit
field is changed. Comparing the field type is not enough for bit fields.
Fix: add proper Field_bit::is_equal() that compares the field lengths as well.
mysql-test/r/type_bit.result@stripped, 2007-05-29 16:24:10+05:00, ramil@stripped +26 -0
Fix for bug #28631: Bit index creation failure after alter
- test result.
mysql-test/t/type_bit.test@stripped, 2007-05-29 16:24:10+05:00, ramil@stripped +17 -0
Fix for bug #28631: Bit index creation failure after alter
- test result.
sql/field.cc@stripped, 2007-05-29 16:24:10+05:00, ramil@stripped +7 -0
Fix for bug #28631: Bit index creation failure after alter
- Field_bit::is_equal() added.
sql/field.h@stripped, 2007-05-29 16:24:10+05:00, ramil@stripped +1 -0
Fix for bug #28631: Bit index creation failure after alter
- Field_bit::is_equal() added.
# 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: ramil
# Host: ramil.myoffice.izhnet.ru
# Root: /home/ram/work/b28631/b28631.5.1
--- 1.395/sql/field.cc 2007-05-29 16:24:17 +05:00
+++ 1.396/sql/field.cc 2007-05-29 16:24:17 +05:00
@@ -8239,6 +8239,13 @@ Field *Field_bit::new_key_field(MEM_ROOT
}
+uint Field_bit::is_equal(create_field *new_field)
+{
+ return (new_field->sql_type == real_type() &&
+ new_field->length == max_display_length());
+}
+
+
int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
--- 1.228/sql/field.h 2007-05-29 16:24:17 +05:00
+++ 1.229/sql/field.h 2007-05-29 16:24:17 +05:00
@@ -1552,6 +1552,7 @@ public:
bit_ptr == ((Field_bit *)field)->bit_ptr &&
bit_ofs == ((Field_bit *)field)->bit_ofs);
}
+ uint is_equal(create_field *new_field);
void move_field_offset(my_ptrdiff_t ptr_diff)
{
Field::move_field_offset(ptr_diff);
--- 1.25/mysql-test/r/type_bit.result 2007-05-29 16:24:17 +05:00
+++ 1.26/mysql-test/r/type_bit.result 2007-05-29 16:24:17 +05:00
@@ -619,3 +619,29 @@ bit_field int_field
handler t1 close;
drop table t1;
End of 5.0 tests
+create table t1(a bit(7));
+insert into t1 values(0x40);
+alter table t1 modify column a bit(8);
+select hex(a) from t1;
+hex(a)
+40
+insert into t1 values(0x80);
+select hex(a) from t1;
+hex(a)
+40
+80
+create index a on t1(a);
+insert into t1 values(0x81);
+select hex(a) from t1;
+hex(a)
+40
+80
+81
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bit(8) DEFAULT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+End of 5.1 tests
--- 1.19/mysql-test/t/type_bit.test 2007-05-29 16:24:17 +05:00
+++ 1.20/mysql-test/t/type_bit.test 2007-05-29 16:24:17 +05:00
@@ -273,3 +273,20 @@ handler t1 close;
drop table t1;
--echo End of 5.0 tests
+
+#
+# Bug #28631: problem after alter
+#
+create table t1(a bit(7));
+insert into t1 values(0x40);
+alter table t1 modify column a bit(8);
+select hex(a) from t1;
+insert into t1 values(0x80);
+select hex(a) from t1;
+create index a on t1(a);
+insert into t1 values(0x81);
+select hex(a) from t1;
+show create table t1;
+drop table t1;
+
+--echo End of 5.1 tests
| Thread |
|---|
| • bk commit into 5.1 tree (ramil:1.2514) BUG#28631 | ramil | 29 May |