11
11
# varbinary as string and number
14
select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ;
14
15
select 0x31+1,concat(0x31)+1,-0xf;
15
16
select x'31',X'ffff'+0;
18
19
# Test of hex constants in WHERE:
21
create table t1 (ID int not null auto_increment,UNIQ bigint not null,primary key (ID),unique (UNIQ) );
22
create table t1 (ID int(8) zerofill not null auto_increment,UNIQ bigint(21) zerofill not null,primary key (ID),unique (UNIQ) );
22
23
insert into t1 set UNIQ=0x38afba1d73e6a18a;
23
24
insert into t1 set UNIQ=123;
24
25
explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a;
45
46
# Bug #19371 VARBINARY() have trailing zeros after upgrade from 4.1
48
# MySQL file formats are not compatible with Drizzle
49
49
# Test with a saved table from 4.1
50
50
copy_file std_data/bug19371.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm;
51
51
chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.frm;
53
53
chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
54
54
copy_file std_data/bug19371.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
55
55
chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
56
--error ER_NO_SUCH_TABLE
58
--error ER_BAD_TABLE_ERROR
57
# Everything _looks_ fine
60
# But the length of the varbinary columns are too long
61
select length(a), length(b) from t1;
63
# Run CHECK TABLE, it should indicate table need a REPAIR TABLE
64
CHECK TABLE t1 FOR UPGRADE;
66
# Run REPAIR TABLE to alter the table and repair
67
# the varbinary fields
70
# Now check it's back to normal
72
select length(a), length(b) from t1;
73
insert into t1 values("ccc", "ddd");
74
select length(a), length(b) from t1;
75
select hex(a), hex(b) from t1;
76
select concat("'", a, "'"), concat("'", b, "'") from t1;
60
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
61
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD
62
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI
64
80
# Check that the fix does not affect table created with current version
65
81
create table t1(a varbinary(255));
82
98
create table table_28127_a(0b02 int);
83
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
84
99
show create table table_28127_a;
86
101
create table table_28127_b(0b2 int);
87
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
88
102
show create table table_28127_b;
90
104
drop table table_28127_a;