summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ramil/ram@ramil.myoffice.izhnet.ru>2007-05-30 08:24:47 +0500
committerunknown <ramil/ram@ramil.myoffice.izhnet.ru>2007-05-30 08:24:47 +0500
commita8ca722aff5efa34ac29f18ad4897bea3d924d25 (patch)
tree48a01b0743db236bb4e1bc2183efbff59a60dff2
parenta7490c4da833da6a9034d62796d1f64f197e028f (diff)
parent4dcf55f236f1b0218ef4ed34daf46f3659bb12d2 (diff)
downloadmariadb-git-a8ca722aff5efa34ac29f18ad4897bea3d924d25.tar.gz
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into mysql.com:/home/ram/work/b28631/b28631.5.1 sql/field.h: Auto merged
-rw-r--r--mysql-test/r/type_bit.result26
-rw-r--r--mysql-test/t/type_bit.test17
-rw-r--r--sql/field.cc7
-rw-r--r--sql/field.h1
4 files changed, 51 insertions, 0 deletions
diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
index e1e51f9a469..8d7843cc0b1 100644
--- a/mysql-test/r/type_bit.result
+++ b/mysql-test/r/type_bit.result
@@ -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
diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test
index 8141bdedd50..d0751549fae 100644
--- a/mysql-test/t/type_bit.test
+++ b/mysql-test/t/type_bit.test
@@ -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
diff --git a/sql/field.cc b/sql/field.cc
index 3d118f630d2..c619f99930c 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -8239,6 +8239,13 @@ Field *Field_bit::new_key_field(MEM_ROOT *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;
diff --git a/sql/field.h b/sql/field.h
index 9a357427eb5..566fc98395a 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -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);