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@stripped, 2006-12-22 20:54:32+03:00, evgen@stripped +3 -0
Bug#14171: Wrong internal default value for a BINARY field.
A BINARY field is represented by the Field_string class. The space character
is used as the filler for unused characters in such a field. But a BINARY field
should use \x00 instead.
Field_string:reset() now detects whether the current field is a BINARY one
and if so uses the \x00 character as a default value filler.
mysql-test/r/type_binary.result@stripped, 2006-12-22 20:53:24+03:00, evgen@stripped +9
-0
Added a test case for the bug#14171: Wrong internal default value for a BINARY field.
mysql-test/t/type_binary.test@stripped, 2006-12-22 20:53:22+03:00, evgen@stripped +8 -0
Added a test case for the bug#14171: Wrong internal default value for a BINARY field.
sql/field.h@stripped, 2006-12-22 20:53:31+03:00, evgen@stripped +2 -1
Bug#14171: Wrong internal default value for a BINARY field.
Field_string:reset() now detects whether the current field is a BINARY one
and if so uses the \x00 character as a default value filler.
# 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/14171-bug-5.0-opt-mysql
--- 1.192/sql/field.h 2006-12-06 20:59:26 +03:00
+++ 1.193/sql/field.h 2006-12-22 20:53:31 +03:00
@@ -1035,7 +1035,8 @@
bool zero_pack() const { return 0; }
int reset(void)
{
- charset()->cset->fill(charset(),ptr,field_length,' ');
+ charset()->cset->fill(charset(),ptr,field_length,
+ (has_charset() ? ' ' : 0));
return 0;
}
int store(const char *to,uint length,CHARSET_INFO *charset);
--- 1.3/mysql-test/r/type_binary.result 2005-12-07 01:16:30 +03:00
+++ 1.4/mysql-test/r/type_binary.result 2006-12-22 20:53:24 +03:00
@@ -136,4 +136,13 @@
ERROR 22001: Data too long for column 'vb' at row 1
drop table t1;
set @@sql_mode= @old_sql_mode;
+create table t1(f1 int, f2 binary(2) not null, f3 char(2) not null);
+insert into t1 set f1=1;
+Warnings:
+Warning 1364 Field 'f2' doesn't have a default value
+Warning 1364 Field 'f3' doesn't have a default value
+select hex(f2), hex(f3) from t1;
+hex(f2) hex(f3)
+0000
+drop table t1;
End of 5.0 tests
--- 1.3/mysql-test/t/type_binary.test 2005-12-07 01:16:30 +03:00
+++ 1.4/mysql-test/t/type_binary.test 2006-12-22 20:53:22 +03:00
@@ -91,4 +91,12 @@
drop table t1;
set @@sql_mode= @old_sql_mode;
+#
+# Bug#14171: Wrong default value for a BINARY field
+#
+create table t1(f1 int, f2 binary(2) not null, f3 char(2) not null);
+insert into t1 set f1=1;
+select hex(f2), hex(f3) from t1;
+drop table t1;
+
--echo End of 5.0 tests
| Thread |
|---|
| • bk commit into 5.0 tree (evgen:1.2349) BUG#14171 | eugene | 22 Dec |