mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Expanding a binary field should result in 0x00-filled positions, not 0x20
(ASCII space). For Bug#16857. sql/field_conv.cc: Bug#16857: Do not expand BINARY fields as if they are strings (which presumably /should/ be filled with spaces). Instead, fill BINARY fields with 0x00 bytes.
This commit is contained in:
@@ -141,3 +141,22 @@ t1 CREATE TABLE `t1` (
|
||||
`a` binary(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (col1 binary(4));
|
||||
insert into t1 values ('a'),('a ');
|
||||
select hex(col1) from t1;
|
||||
hex(col1)
|
||||
61000000
|
||||
61200000
|
||||
alter table t1 modify col1 binary(10);
|
||||
select hex(col1) from t1;
|
||||
hex(col1)
|
||||
61000000000000000000
|
||||
61200000000000000000
|
||||
insert into t1 values ('b'),('b ');
|
||||
select hex(col1) from t1;
|
||||
hex(col1)
|
||||
61000000000000000000
|
||||
61200000000000000000
|
||||
62000000000000000000
|
||||
62200000000000000000
|
||||
drop table t1;
|
||||
|
@@ -89,3 +89,15 @@ show create table t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#16857
|
||||
#
|
||||
create table t1 (col1 binary(4));
|
||||
insert into t1 values ('a'),('a ');
|
||||
select hex(col1) from t1;
|
||||
alter table t1 modify col1 binary(10);
|
||||
select hex(col1) from t1;
|
||||
insert into t1 values ('b'),('b ');
|
||||
select hex(col1) from t1;
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user