Commit 8ba02d72 authored by unknown's avatar unknown

Added a test case for Bug#18038 MySQL server corrupts binary columns data

parent d4df3f23
...@@ -621,3 +621,23 @@ create table t1 (t varchar(255) default null, key t (t(80))) ...@@ -621,3 +621,23 @@ create table t1 (t varchar(255) default null, key t (t(80)))
engine=myisam default charset=latin1; engine=myisam default charset=latin1;
alter table t1 change t t text; alter table t1 change t t text;
drop table t1; drop table t1;
CREATE TABLE t1 (s CHAR(8) BINARY);
INSERT INTO t1 VALUES ('test');
SELECT LENGTH(s) FROM t1;
LENGTH(s)
4
ALTER TABLE t1 MODIFY s CHAR(10) BINARY;
SELECT LENGTH(s) FROM t1;
LENGTH(s)
4
DROP TABLE t1;
CREATE TABLE t1 (s BINARY(8));
INSERT INTO t1 VALUES ('test');
SELECT LENGTH(s) FROM t1;
LENGTH(s)
8
ALTER TABLE t1 MODIFY s BINARY(10);
SELECT LENGTH(s) FROM t1;
LENGTH(s)
10
DROP TABLE t1;
...@@ -449,3 +449,21 @@ create table t1 (t varchar(255) default null, key t (t(80))) ...@@ -449,3 +449,21 @@ create table t1 (t varchar(255) default null, key t (t(80)))
engine=myisam default charset=latin1; engine=myisam default charset=latin1;
alter table t1 change t t text; alter table t1 change t t text;
drop table t1; drop table t1;
#
# Bug#18038 MySQL server corrupts binary columns data
#
CREATE TABLE t1 (s CHAR(8) BINARY);
INSERT INTO t1 VALUES ('test');
SELECT LENGTH(s) FROM t1;
ALTER TABLE t1 MODIFY s CHAR(10) BINARY;
SELECT LENGTH(s) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (s BINARY(8));
INSERT INTO t1 VALUES ('test');
SELECT LENGTH(s) FROM t1;
ALTER TABLE t1 MODIFY s BINARY(10);
SELECT LENGTH(s) FROM t1;
DROP TABLE t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment