fast_update_key.test 2.08 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
source include/have_tokudb.inc;

set default_storage_engine='tokudb';

disable_warnings;
drop table if exists t;
enable_warnings;

set tokudb_disable_slow_update=1;

# must have primary key
create table t (ida int not null, idb bigint not null, idc tinyint unsigned not null, x bigint);
replace_regex /MariaDB/XYZ/ /MySQL/XYZ/;
error ER_UNSUPPORTED_EXTENSION;
15
update noar t set x=x+1 where ida=1;
16 17 18 19 20 21
drop table t;

# must have no clustering keys
create table t (ida int not null, idb bigint not null, idc tinyint unsigned not null, x bigint, clustering key(ida,idb,idc));
replace_regex /MariaDB/XYZ/ /MySQL/XYZ/;
error ER_UNSUPPORTED_EXTENSION;
22
update noar t set x=x+1 where ida=1;
23 24
drop table t;

25
# update noar field must not be part of any key
26 27 28
create table t (ida int not null, idb bigint not null, idc tinyint unsigned not null, x bigint, primary key(ida,idb,idc), key(x));
replace_regex /MariaDB/XYZ/ /MySQL/XYZ/;
error ER_UNSUPPORTED_EXTENSION;
29
update noar t set x=x+1 where ida=1;
30 31
drop table t;

32 33 34 35
# must have no pk prefixed
create table t (id char(32), x bigint, primary key(id(1)));
replace_regex /MariaDB/XYZ/ /MySQL/XYZ/;
error ER_UNSUPPORTED_EXTENSION;
36
update noar t set x=x+1 where id='hi';
37 38 39 40 41
drop table t;

create table t (id varchar(32), x bigint, primary key(id(1)));
replace_regex /MariaDB/XYZ/ /MySQL/XYZ/;
error ER_UNSUPPORTED_EXTENSION;
42
update noar t set x=x+1 where id='hi';
43 44
drop table t;

45 46 47 48 49 50
# test for point updates on compound keys
create table t (ida int not null, idb bigint not null, idc tinyint unsigned not null, x bigint, primary key(ida,idb,idc));
insert into t values (1,2,3,0);

replace_regex /MariaDB/XYZ/ /MySQL/XYZ/;
error ER_UNSUPPORTED_EXTENSION;
51
update noar t set x=x+1 where ida=1;
52 53 54

replace_regex /MariaDB/XYZ/ /MySQL/XYZ/;
error ER_UNSUPPORTED_EXTENSION;
55
update noar t set x=x+1 where ida=1 and idb=2;
56 57 58

replace_regex /MariaDB/XYZ/ /MySQL/XYZ/;
error ER_UNSUPPORTED_EXTENSION;
59
update noar t set x=x+1 where ida=1 and idb=2 or idc=3;
60

61
update noar t set x=x+1 where ida=1 and idb=2 and idc=3;
62 63
select * from t;

64
update noar t set x=x+1 where idc=3 and ida=1 and idb=2;
65 66 67 68 69 70 71
select * from t;

drop table t;