summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/alter_table.test2
-rw-r--r--mysql-test/t/binary.test2
-rw-r--r--mysql-test/t/cast.test2
-rw-r--r--mysql-test/t/ctype_cp1251.test2
-rw-r--r--mysql-test/t/ctype_many.test4
-rw-r--r--mysql-test/t/federated.test4
-rw-r--r--mysql-test/t/func_in.test2
-rw-r--r--mysql-test/t/ndb_condition_pushdown.test2
-rw-r--r--mysql-test/t/ndb_types.test2
-rw-r--r--mysql-test/t/sp.test2
-rw-r--r--mysql-test/t/type_binary.test67
-rw-r--r--mysql-test/t/type_blob.test4
12 files changed, 81 insertions, 14 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 2e5b68c1dc7..bae94656125 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -278,7 +278,7 @@ insert into t1 values ('ΤΕΣΤ');
select a,hex(a) from t1;
alter table t1 change a a char(10) character set cp1251;
select a,hex(a) from t1;
-alter table t1 change a a binary(10);
+alter table t1 change a a binary(4);
select a,hex(a) from t1;
alter table t1 change a a char(10) character set cp1251;
select a,hex(a) from t1;
diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test
index 02773b32302..1ac0cfebb28 100644
--- a/mysql-test/t/binary.test
+++ b/mysql-test/t/binary.test
@@ -56,7 +56,7 @@ drop table t1;
#
# Test of binary and upper/lower
#
-create table t1 (a char(15) binary, b binary(15));
+create table t1 (a char(3) binary, b binary(3));
insert into t1 values ('aaa','bbb'),('AAA','BBB');
select upper(a),upper(b) from t1;
select lower(a),lower(b) from t1;
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 028cb08620e..70eb87131df 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -101,7 +101,7 @@ drop table t1;
# Bug 2202
# CAST from BINARY to non-BINARY and from non-BINARY to BINARY
#
-create table t1 (a binary(10), b char(10) character set koi8r);
+create table t1 (a binary(4), b char(4) character set koi8r);
insert into t1 values (_binary'ΤΕΣΤ',_binary'ΤΕΣΤ');
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
set names koi8r;
diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test
index 1aafe7b7266..463a9cea4bc 100644
--- a/mysql-test/t/ctype_cp1251.test
+++ b/mysql-test/t/ctype_cp1251.test
@@ -21,7 +21,7 @@ drop table t1;
#
# Test of binary and upper/lower
#
-create table t1 (a char(15) binary, b binary(15)) character set cp1251;
+create table t1 (a char(3) binary, b binary(3)) character set cp1251;
insert into t1 values ('aaa','bbb'),('AAA','BBB');
select upper(a),upper(b) from t1;
select lower(a),lower(b) from t1;
diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test
index 22e844c6868..0903c3dd7fa 100644
--- a/mysql-test/t/ctype_many.test
+++ b/mysql-test/t/ctype_many.test
@@ -148,7 +148,7 @@ SET CHARACTER SET koi8r;
SELECT * FROM t1;
-ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL default '';
+ALTER TABLE t1 ADD bin_f CHAR(1) BYTE NOT NULL default '';
UPDATE t1 SET bin_f=koi8_ru_f;
SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
@@ -204,7 +204,7 @@ UPDATE t1 SET greek_f=CONVERT(ucs2_f USING greek) WHERE comment LIKE _latin2'GRE
UPDATE t1 SET armscii8_f=CONVERT(ucs2_f USING armscii8) WHERE comment LIKE _latin2'ARM%';
UPDATE t1 SET utf8_f=CONVERT(ucs2_f USING utf8) WHERE utf8_f=_utf8'';
UPDATE t1 SET ucs2_f=CONVERT(utf8_f USING ucs2) WHERE ucs2_f=_ucs2'';
-SELECT * FROM t1;
+SELECT comment, koi8_ru_f, utf8_f, hex(bin_f), ucs2_f, armscii8_f, greek_f FROM t1;
SET CHARACTER SET 'binary';
SELECT * FROM t1;
SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f;
diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test
index b1b6baa2f33..9880cd78653 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/t/federated.test
@@ -351,7 +351,7 @@ DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
`id` int NOT NULL auto_increment,
`name` char(32) NOT NULL DEFAULT '',
- `bincol` binary(4) NOT NULL,
+ `bincol` binary(1) NOT NULL,
`floatval` decimal(5,2) NOT NULL DEFAULT 0.0,
`other` int NOT NULL DEFAULT 0,
PRIMARY KEY (id),
@@ -366,7 +366,7 @@ DROP TABLE IF EXISTS federated.t1;
eval CREATE TABLE federated.t1 (
`id` int NOT NULL auto_increment,
`name` char(32) NOT NULL DEFAULT '',
- `bincol` binary(4) NOT NULL,
+ `bincol` binary(1) NOT NULL,
`floatval` decimal(5,2) NOT NULL DEFAULT 0.0,
`other` int NOT NULL DEFAULT 0,
PRIMARY KEY (id),
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index dd4edd8ca48..0472968f918 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -97,7 +97,7 @@ select 1 in ('1.1',2.0);
# Test case for bug #6365
-create table t1 (a char(20) character set binary);
+create table t1 (a char(2) character set binary);
insert into t1 values ('aa'), ('bb');
select * from t1 where a in (NULL, 'aa');
drop table t1;
diff --git a/mysql-test/t/ndb_condition_pushdown.test b/mysql-test/t/ndb_condition_pushdown.test
index d090d12e81b..9f512430085 100644
--- a/mysql-test/t/ndb_condition_pushdown.test
+++ b/mysql-test/t/ndb_condition_pushdown.test
@@ -12,7 +12,7 @@ CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
string char(10),
vstring varchar(10),
- bin binary(7),
+ bin binary(2),
vbin varbinary(7),
tiny tinyint(4) DEFAULT '0' NOT NULL ,
short smallint(6) DEFAULT '1' NOT NULL ,
diff --git a/mysql-test/t/ndb_types.test b/mysql-test/t/ndb_types.test
index 3446a409b2a..10b8eb87e2c 100644
--- a/mysql-test/t/ndb_types.test
+++ b/mysql-test/t/ndb_types.test
@@ -12,7 +12,7 @@ CREATE TABLE t1 (
auto int(5) unsigned NOT NULL auto_increment,
string char(10) default "hello",
vstring varchar(10) default "hello",
- bin binary(7),
+ bin binary(2),
vbin varbinary(7),
tiny tinyint(4) DEFAULT '0' NOT NULL ,
short smallint(6) DEFAULT '1' NOT NULL ,
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index e16e7456056..1f4d5b6bad5 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -2431,7 +2431,7 @@ create function bug3788() returns date return cast("2005-03-04" as date)|
select bug3788()|
drop function bug3788|
-create function bug3788() returns binary(5) return 5|
+create function bug3788() returns binary(1) return 5|
select bug3788()|
drop function bug3788|
diff --git a/mysql-test/t/type_binary.test b/mysql-test/t/type_binary.test
new file mode 100644
index 00000000000..b5928cb14c4
--- /dev/null
+++ b/mysql-test/t/type_binary.test
@@ -0,0 +1,67 @@
+# check 0x00 padding
+create table t1 (s1 binary(3));
+insert into t1 values (0x61), (0x6120), (0x612020);
+select hex(s1) from t1;
+drop table t1;
+
+# check that 0x00 is not stripped in val_str
+create table t1 (s1 binary(2), s2 varbinary(2));
+insert into t1 values (0x4100,0x4100);
+select length(concat('*',s1,'*',s2,'*')) from t1;
+delete from t1;
+insert into t1 values (0x4120,0x4120);
+select length(concat('*',s1,'*',s2,'*')) from t1;
+drop table t1;
+
+# check that trailing 0x00 and 0x20 do matter on comparison
+create table t1 (s1 varbinary(20), s2 varbinary(20));
+show create table t1;
+insert into t1 values (0x41,0x4100),(0x41,0x4120),(0x4100,0x4120);
+select hex(s1), hex(s2) from t1;
+select count(*) from t1 where s1 < s2;
+drop table t1;
+
+# check that trailing 0x00 do matter on filesort
+create table t1 (s1 varbinary(2), s2 varchar(1));
+insert into t1 values (0x41,'a'), (0x4100,'b'), (0x41,'c'), (0x4100,'d');
+select hex(s1),s2 from t1 order by s1,s2;
+drop table t1;
+
+# check that 0x01 is padded to 0x0100 and thus we get a duplicate value
+create table t1 (s1 binary(2) primary key);
+insert into t1 values (0x01);
+insert into t1 values (0x0120);
+--error 1062
+insert into t1 values (0x0100);
+select hex(s1) from t1 order by s1;
+# check index search
+select hex(s1) from t1 where s1=0x01;
+select hex(s1) from t1 where s1=0x0120;
+select hex(s1) from t1 where s1=0x0100;
+select count(distinct s1) from t1;
+alter table t1 drop primary key;
+# check non-indexed search
+select hex(s1) from t1 where s1=0x01;
+select hex(s1) from t1 where s1=0x0120;
+select hex(s1) from t1 where s1=0x0100;
+select count(distinct s1) from t1;
+drop table t1;
+
+# check that 0x01 is not padded, and all three values are unique
+create table t1 (s1 varbinary(2) primary key);
+insert into t1 values (0x01);
+insert into t1 values (0x0120);
+insert into t1 values (0x0100);
+select hex(s1) from t1 order by s1;
+# check index search
+select hex(s1) from t1 where s1=0x01;
+select hex(s1) from t1 where s1=0x0120;
+select hex(s1) from t1 where s1=0x0100;
+select count(distinct s1) from t1;
+alter table t1 drop primary key;
+# check non-indexed search
+select hex(s1) from t1 where s1=0x01;
+select hex(s1) from t1 where s1=0x0120;
+select hex(s1) from t1 where s1=0x0100;
+select count(distinct s1) from t1;
+drop table t1;
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 1ec5c600296..4f3c02b0465 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -67,9 +67,9 @@ select * from t1;
drop table t1;
#
-# test of blob, text, char and char binary
+# test of blob, text, char and varbinary
#
-create table t1 (t text,c char(10),b blob, d binary(10));
+create table t1 (t text,c char(10),b blob, d varbinary(10));
insert into t1 values (NULL,NULL,NULL,NULL);
insert into t1 values ("","","","");
insert into t1 values ("hello","hello","hello","hello");