diff options
author | unknown <jimw@mysql.com> | 2005-12-06 18:15:18 -0800 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-12-06 18:15:18 -0800 |
commit | 4b9a7c7c7a47b039d5542b6c2fb009872f78202c (patch) | |
tree | d8cfc6b5c3d06042fdfef8446b117772e861233a /mysql-test | |
parent | 8c2d8ac7503e75d775a3ba78f9c6c4dbbac94266 (diff) | |
parent | bf802ab7684019e14a0009169010a9542fced065 (diff) | |
download | mariadb-git-4b9a7c7c7a47b039d5542b6c2fb009872f78202c.tar.gz |
Merge bk-internal:/home/bk/mysql-5.0
into mysql.com:/home/jimw/my/mysql-5.0-clean
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/type_binary.result | 23 | ||||
-rw-r--r-- | mysql-test/t/type_binary.test | 24 |
2 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/r/type_binary.result b/mysql-test/r/type_binary.result index 1c60bf46608..597defb7a9b 100644 --- a/mysql-test/r/type_binary.result +++ b/mysql-test/r/type_binary.result @@ -114,3 +114,26 @@ drop table t1; select hex(cast(0x10 as binary(2))); hex(cast(0x10 as binary(2))) 1000 +create table t1 (b binary(2), vb varbinary(2)); +insert into t1 values(0x4120, 0x4120); +insert into t1 values(0x412020, 0x412020); +Warnings: +Warning 1265 Data truncated for column 'b' at row 1 +Warning 1265 Data truncated for column 'vb' at row 1 +drop table t1; +create table t1 (c char(2), vc varchar(2)); +insert into t1 values(0x4120, 0x4120); +insert into t1 values(0x412020, 0x412020); +Warnings: +Note 1265 Data truncated for column 'vc' at row 1 +drop table t1; +set @old_sql_mode= @@sql_mode, sql_mode= 'traditional'; +create table t1 (b binary(2), vb varbinary(2)); +insert into t1 values(0x4120, 0x4120); +insert into t1 values(0x412020, NULL); +ERROR 22001: Data too long for column 'b' at row 1 +insert into t1 values(NULL, 0x412020); +ERROR 22001: Data too long for column 'vb' at row 1 +drop table t1; +set @@sql_mode= @old_sql_mode; +End of 5.0 tests diff --git a/mysql-test/t/type_binary.test b/mysql-test/t/type_binary.test index 451363c1ae4..1639aff4711 100644 --- a/mysql-test/t/type_binary.test +++ b/mysql-test/t/type_binary.test @@ -68,3 +68,27 @@ drop table t1; # check that cast appends trailing zeros select hex(cast(0x10 as binary(2))); + +# +# Bug #14299: BINARY space truncation should cause warning or error +# +create table t1 (b binary(2), vb varbinary(2)); +insert into t1 values(0x4120, 0x4120); +insert into t1 values(0x412020, 0x412020); +drop table t1; +create table t1 (c char(2), vc varchar(2)); +insert into t1 values(0x4120, 0x4120); +insert into t1 values(0x412020, 0x412020); +drop table t1; + +set @old_sql_mode= @@sql_mode, sql_mode= 'traditional'; +create table t1 (b binary(2), vb varbinary(2)); +insert into t1 values(0x4120, 0x4120); +--error ER_DATA_TOO_LONG +insert into t1 values(0x412020, NULL); +--error ER_DATA_TOO_LONG +insert into t1 values(NULL, 0x412020); +drop table t1; +set @@sql_mode= @old_sql_mode; + +--echo End of 5.0 tests |