1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
|
let datadir=`select @@datadir`;
--source include/have_partition.inc
#
# MDEV-371 Unique indexes for blobs
#
--echo #Structure of tests
--echo #First we will check all option for
--echo #table containing single unique column
--echo #table containing keys like unique(a,b,c,d) etc
--echo #then table containing 2 blob unique etc
--echo #table with single long blob column;
create table t1(a blob unique );
insert into t1 values(1),(2),(3),(56),('sachin'),('maria'),(123456789034567891),(null),(null),(123456789034567890);
--echo #blob with primary key not allowed
--error ER_TOO_LONG_KEY
create table t2(a blob,primary key(a(10000)));
--error ER_TOO_LONG_KEY
create table t3(a varchar(10000) primary key);
--error ER_DUP_ENTRY
insert into t1 values(2);
--echo #table structure;
desc t1;
show create table t1;
query_vertical show keys from t1;
replace_result $datadir DATADIR;
exec $MYISAMCHK -d $datadir/test/t1;
select TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,ORDINAL_POSITION,COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,CHARACTER_OCTET_LENGTH,NUMERIC_PRECISION,NUMERIC_SCALE,DATETIME_PRECISION,CHARACTER_SET_NAME,COLLATION_NAME,COLUMN_TYPE,COLUMN_KEY,EXTRA,COLUMN_COMMENT,IS_GENERATED,GENERATION_EXPRESSION from information_schema.columns where table_schema = 'test' and table_name = 't1';
select * from information_schema.statistics where table_schema = 'test' and table_name = 't1';
query_vertical select * from information_schema.key_column_usage where table_schema= 'test' and table_name= 't1';
--echo # table select we should not be able to see db_row_hash_column;
select * from t1 order by a;
--error ER_BAD_FIELD_ERROR
select db_row_hash_1 from t1;
--echo #duplicate entry test;
--error ER_DUP_ENTRY
insert into t1 values(2);
--error ER_DUP_ENTRY
insert into t1 values('sachin');
--error ER_DUP_ENTRY
insert into t1 values(123456789034567891);
select * from t1 order by a;
insert into t1 values(11),(22),(33);
--error ER_DUP_ENTRY
insert into t1 values(12),(22);
select * from t1 order by a;
insert into t1 values(repeat('s',4000*10)),(repeat('s',4001*10));
--error ER_DUP_ENTRY
insert into t1 values(repeat('m',4000*10)),(repeat('m',4000*10));
insert into t1 values(repeat('m',4001)),(repeat('m',4002));
truncate table t1;
insert into t1 values(1),(2),(3),(4),(5),(8),(7);
replace_result $datadir DATADIR;
exec $MYISAMCHK -d $datadir/test/t1;
--echo #now some alter commands;
alter table t1 add column b int;
desc t1;
show create table t1;
--error ER_DUP_ENTRY
insert into t1 values(1,2);
--error ER_DUP_ENTRY
insert into t1 values(2,2);
--error ER_BAD_FIELD_ERROR
select db_row_hash_1 from t1;
--echo #now try to change db_row_hash_1 column;
--error ER_CANT_DROP_FIELD_OR_KEY
alter table t1 drop column db_row_hash_1;
--error ER_CANT_DROP_FIELD_OR_KEY
alter table t1 add column d int , add column e int , drop column db_row_hash_1;
--error ER_BAD_FIELD_ERROR
alter table t1 modify column db_row_hash_1 int ;
--error ER_BAD_FIELD_ERROR
alter table t1 add column a int , add column b int, modify column db_row_hash_1 int ;
--error ER_BAD_FIELD_ERROR
alter table t1 change column db_row_hash_1 dsds int;
--error ER_BAD_FIELD_ERROR
alter table t1 add column asd int, change column db_row_hash_1 dsds int;
alter table t1 drop column b , add column c int;
show create table t1;
--echo #now add some column with name db_row_hash;
alter table t1 add column db_row_hash_1 int unique;
show create table t1;
--error ER_DUP_ENTRY
insert into t1 values(45,1,55),(46,1,55);
--error ER_DUP_ENTRY
insert into t1 values(45,1,55),(45,1,55);
alter table t1 add column db_row_hash_2 int, add column db_row_hash_3 int;
desc t1;
--echo #this should also drop the unique index ;
alter table t1 drop column a;
show create table t1;
show keys from t1;
--echo #add column with unique index on blob ;
alter table t1 add column a blob unique;
show create table t1;
--echo # try to change the blob unique name;
alter table t1 change column a aa blob ;
show create table t1;
show keys from t1;
--echo # try to change the blob unique datatype;
--echo #this will change index to b tree;
alter table t1 modify column aa int ;
show create table t1;
show keys from t1;
alter table t1 add column clm blob unique;
--echo #try changing the name ;
alter table t1 change column clm clm_changed blob;
show create table t1;
show keys from t1;
--echo #now drop the unique key;
alter table t1 drop key clm;
show create table t1;
show keys from t1;
drop table t1;
create table t1 (a TEXT CHARSET latin1 COLLATE latin1_german2_ci unique);
desc t1;
show keys from t1;
insert into t1 values ('ae');
--error ER_DUP_ENTRY
insert into t1 values ('AE');
insert into t1 values ('Ä');
drop table t1;
create table t1 (a int primary key, b blob unique);
desc t1;
show keys from t1;
insert into t1 values(1,1),(2,2),(3,3);
--error ER_DUP_ENTRY
insert into t1 values(1,1);
--error ER_DUP_ENTRY
insert into t1 values(7,1);
drop table t1;
--echo #table with multiple long blob column and varchar text column ;
create table t1(a blob unique, b int , c blob unique , d text unique , e varchar(3000) unique) charset=latin1;
insert into t1 values(1,2,3,4,5),(2,11,22,33,44),(3111,222,333,444,555),(5611,2222,3333,4444,5555),
('sachin',341,'fdf','gfgfgfg','hghgr'),('maria',345,'frter','dasd','utyuty'),
(123456789034567891,353534,53453453453456,64565464564564,45435345345345),
(123456789034567890,43545,657567567567,78967657567567,657567567567567676);
--echo #table structure;
desc t1;
show create table t1;
show keys from t1;
replace_result $datadir DATADIR;
exec $MYISAMCHK -d $datadir/test/t1;
select TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,ORDINAL_POSITION,COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,CHARACTER_OCTET_LENGTH,NUMERIC_PRECISION,NUMERIC_SCALE,DATETIME_PRECISION,CHARACTER_SET_NAME,COLLATION_NAME,COLUMN_TYPE,COLUMN_KEY,EXTRA,COLUMN_COMMENT,IS_GENERATED,GENERATION_EXPRESSION from information_schema.columns where table_schema = 'test' and table_name = 't1';
select * from information_schema.statistics where table_schema = 'test' and table_name = 't1';
select * from information_schema.key_column_usage where table_schema= 'test' and table_name= 't1';
--echo #table select we should not be able to see db_row_hash_1 column;
select * from t1 order by a;
--error ER_BAD_FIELD_ERROR
select db_row_hash_1 from t1;
--error ER_BAD_FIELD_ERROR
select db_row_hash_2 from t1;
--error ER_BAD_FIELD_ERROR
select db_row_hash_3 from t1;
--echo #duplicate entry test;
--error ER_DUP_ENTRY
insert into t1 values(21,2,3,42,51);
--error ER_DUP_ENTRY
insert into t1 values('sachin',null,null,null,null);
--error ER_DUP_ENTRY
insert into t1 values(1234567890345671890,4353451,6575675675617,789676575675617,657567567567567676);
select * from t1 order by a;
insert into t1 values(repeat('s',4000*10),100,repeat('s',4000*10),repeat('s',4000*10),
repeat('s',400)),(repeat('s',4001*10),1000,repeat('s',4001*10),repeat('s',4001*10),
repeat('s',2995));
--error ER_DUP_ENTRY
insert into t1 values(repeat('m',4000*11),10,repeat('s',4000*11),repeat('s',4000*11),repeat('s',2995));
truncate table t1;
insert into t1 values(1,2,3,4,5),(2,11,22,33,44),(3111,222,333,444,555),(5611,2222,3333,4444,5555);
--echo #now some alter commands;
alter table t1 add column f int;
desc t1;
show create table t1;
--echo #unique key should not break;
--error ER_DUP_ENTRY
insert into t1 values(1,2,3,4,5,6);
--error ER_BAD_FIELD_ERROR
select db_row_hash_1 , db_row_hash_2, db_row_hash_3 from t1;
--echo #now try to change db_row_hash_1 column;
--error ER_CANT_DROP_FIELD_OR_KEY
alter table t1 drop column db_row_hash_1, drop column db_row_hash_2, drop column db_row_hash_3;
--error ER_CANT_DROP_FIELD_OR_KEY
alter table t1 add column dg int , add column ef int , drop column db_row_hash_1;
--error ER_BAD_FIELD_ERROR
alter table t1 modify column db_row_hash_1 int , modify column db_row_hash_2 int, modify column db_row_hash_3 int;
--error ER_BAD_FIELD_ERROR
alter table t1 add column ar int , add column rb int, modify column db_row_hash_1 int , modify column db_row_hash_3 int;
--error ER_BAD_FIELD_ERROR
alter table t1 change column db_row_hash_1 dsds int , change column db_row_hash_2 dfdf int , change column db_row_hash_3 gdfg int ;
--error ER_BAD_FIELD_ERROR
alter table t1 add column asd int, drop column a, change column db_row_hash_1 dsds int, change db_row_hash_3 fdfdfd int;
alter table t1 drop column b , add column g int;
show create table t1;
--echo #now add some column with name db_row_hash;
alter table t1 add column db_row_hash_1 int unique;
alter table t1 add column db_row_hash_2 int unique;
alter table t1 add column db_row_hash_3 int unique;
show create table t1;
alter table t1 add column db_row_hash_7 int, add column db_row_hash_5 int , add column db_row_hash_4 int ;
alter table t1 drop column db_row_hash_7,drop column db_row_hash_3, drop column db_row_hash_4;
desc t1;
--echo #this should not break anything;
--error ER_DUP_ENTRY
insert into t1 values(1,2,3,4,5,6,23,5,6);
--echo #this should also drop the unique index;
alter table t1 drop column a, drop column c;
show create table t1;
show keys from t1;
--echo #add column with unique index on blob;
alter table t1 add column a blob unique;
show create table t1;
show keys from t1;
--echo #try to change the blob unique column name;
--echo #this will change index to b tree;
alter table t1 modify column a int , modify column e int;
show create table t1;
show keys from t1;
alter table t1 add column clm1 blob unique,add column clm2 blob unique;
--echo #try changing the name;
alter table t1 change column clm1 clm_changed1 blob, change column clm2 clm_changed2 blob;
show create table t1;
show keys from t1;
--echo #now drop the unique key;
alter table t1 drop key clm1, drop key clm2;
show create table t1;
show keys from t1;
drop table t1;
--echo #now the table with key on multiple columns; the ultimate test;
create table t1(a blob, b int , c varchar(2000) , d text , e varchar(3000) , f longblob , g int , h text ,
unique(a,b,c), unique(c,d,e),unique(e,f,g,h), unique(b,d,g,h)) charset=latin1;
insert into t1 values(1,1,1,1,1,1,1,1),(2,2,2,2,2,2,2,2),(3,3,3,3,3,3,3,3),(4,4,4,4,4,4,4,4),(5,5,5,5,5,5,5,5),
('maria',6,'maria','maria','maria','maria',6,'maria'),('mariadb',7,'mariadb','mariadb','mariadb','mariadb',8,'mariadb')
,(null,null,null,null,null,null,null,null),(null,null,null,null,null,null,null,null);
--echo #table structure;
desc t1;
show create table t1;
show keys from t1;
replace_result $datadir DATADIR;
exec $MYISAMCHK -d $datadir/test/t1;
select TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,ORDINAL_POSITION,COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,CHARACTER_OCTET_LENGTH,NUMERIC_PRECISION,NUMERIC_SCALE,DATETIME_PRECISION,CHARACTER_SET_NAME,COLLATION_NAME,COLUMN_TYPE,COLUMN_KEY,EXTRA,COLUMN_COMMENT,IS_GENERATED,GENERATION_EXPRESSION from information_schema.columns where table_schema = 'test' and table_name = 't1';
select * from information_schema.statistics where table_schema = 'test' and table_name = 't1';
select * from information_schema.key_column_usage where table_schema= 'test' and table_name= 't1';
--echo # table select we should not be able to see db_row_hash_1 column;
select * from t1 order by a;
--error ER_BAD_FIELD_ERROR
select db_row_hash_1 from t1;
--error ER_BAD_FIELD_ERROR
select db_row_hash_2 from t1;
--error ER_BAD_FIELD_ERROR
select db_row_hash_3 from t1;
--echo #duplicate entry test;
--echo #duplicate keys entry;
--error ER_DUP_ENTRY
insert into t1 values(1,1,1,0,0,0,0,0);
--error ER_DUP_ENTRY
insert into t1 values(0,0,1,1,1,0,0,0);
--error ER_DUP_ENTRY
insert into t1 values(0,0,0,0,1,1,1,1);
--error ER_DUP_ENTRY
insert into t1 values(1,1,1,1,1,0,0,0);
--error ER_DUP_ENTRY
insert into t1 values(0,0,0,0,1,1,1,1);
--error ER_DUP_ENTRY
insert into t1 values(1,1,1,1,1,1,1,1);
--error ER_BAD_FIELD_ERROR
select db_row_hash_1,db_row_hash_2,db_row_hash_3,db_row_hash_4,db_row_hash_5 from t1;
--error ER_CANT_DROP_FIELD_OR_KEY
alter table t1 drop column db_row_hash_1, drop column db_row_hash_2, drop column db_row_hash_3;
--error ER_CANT_DROP_FIELD_OR_KEY
alter table t1 add column dg int , add column ef int , drop column db_row_hash_1;
--error ER_BAD_FIELD_ERROR
alter table t1 modify column db_row_hash_1 int , modify column db_row_hash_2 int, modify column db_row_hash_3 int;
--error ER_BAD_FIELD_ERROR
alter table t1 add column ar int , add column rb int, modify column db_row_hash_1 int , modify column db_row_hash_3 int;
--error ER_BAD_FIELD_ERROR
alter table t1 change column db_row_hash_1 dsds int , change column db_row_hash_2 dfdf int , change column db_row_hash_3 gdfg int ;
--error ER_BAD_FIELD_ERROR
alter table t1 add column asd int, drop column a, change column db_row_hash_1 dsds int, change db_row_hash_3 fdfdfd int;
show create table t1;
--echo # add column named db_row_hash_*;
alter table t1 add column db_row_hash_7 int , add column db_row_hash_5 int,
add column db_row_hash_1 int, add column db_row_hash_2 int;
show create table t1;
show keys from t1;
alter table t1 drop column db_row_hash_7 , drop column db_row_hash_5 ,
drop column db_row_hash_1, drop column db_row_hash_2 ;
show create table t1;
show keys from t1;
--echo #try to change column names;
alter table t1 change column a aa blob , change column b bb blob , change column d dd blob;
show create table t1;
show keys from t1;
alter table t1 change column aa a blob , change column bb b blob , change column dd d blob;
show create table t1;
show keys from t1;
--echo #now we will change the data type to int and varchar limit so that we no longer require hash_index;
--echo #on key a_b_c;
alter table t1 modify column a varchar(20) , modify column b varchar(20) , modify column c varchar(20);
show create table t1;
show keys from t1;
--echo #change it back;
alter table t1 modify column a blob , modify column b blob , modify column c blob;
show create table t1;
show keys from t1;
--echo #try to delete blob column in unique;
truncate table t1;
## this feature removed in 10.2
#alter table t1 drop column a, drop column b, drop column c;
#show create table t1;
#show keys from t1;
--echo #now try to delete keys;
alter table t1 drop key c, drop key e;
show create table t1;
show keys from t1;
drop table t1;
--echo #now alter table containing some data basically some tests with ignore;
create table t1 (a blob);
insert into t1 values(1),(2),(3);
--echo #normal alter table;
alter table t1 add unique key(a);
alter table t1 drop key a;
truncate table t1;
insert into t1 values(1),(1),(2),(2),(3);
--error ER_DUP_ENTRY
alter table t1 add unique key(a);
alter ignore table t1 add unique key(a);
select * from t1 order by a;
--error ER_DUP_ENTRY
insert into t1 values(1);
show create table t1;
show keys from t1;
drop table t1;
--echo #Now with multiple keys;
create table t1(a blob , b blob, c blob , d blob , e int);
insert into t1 values (1,1,1,1,1);
insert into t1 values (1,1,1,1,1);
insert into t1 values (2,1,1,1,1);
insert into t1 values (2,2,2,2,2);
insert into t1 values (3,3,4,4,4);
insert into t1 values (4,4,4,4,4);
--error ER_DUP_ENTRY
alter table t1 add unique key(a,c), add unique key(b,d), add unique key(e);
alter ignore table t1 add unique key(a,c), add unique key(b,d), add unique key(e);
select * from t1 order by a;
--error ER_DUP_ENTRY
insert into t1 values (1,12,1,13,14);
--error ER_DUP_ENTRY
insert into t1 values (12,1,14,1,14);
--error ER_DUP_ENTRY
insert into t1 values (13,12,13,14,4);
show create table t1;
show keys from t1;
drop table t1;
--echo #visibility of db_row_hash
create table t1 (a blob unique , b blob unique);
desc t1;
insert into t1 values(1,19);
insert into t1 values(2,29);
insert into t1 values(3,39);
insert into t1 values(4,49);
create table t2 (DB_ROW_HASH_1 int, DB_ROW_HASH_2 int);
insert into t2 values(11,1);
insert into t2 values(22,2);
insert into t2 values(33,3);
insert into t2 values(44,4);
select * from t1 order by a;
select * from t2 order by DB_ROW_HASH_1;
--error ER_BAD_FIELD_ERROR
select DB_ROW_HASH_1, DB_ROW_HASH_2 from t1;
--echo #bug
select DB_ROW_HASH_1, DB_ROW_HASH_2 from t1,t2;
--error ER_BAD_FIELD_ERROR
select * from t1 where DB_ROW_HASH_1 in (select DB_ROW_HASH_1 from t2);
--sorted_result
select DB_ROW_HASH_1, DB_ROW_HASH_2 from t1,t2 where DB_ROW_HASH_1 in (select DB_ROW_HASH_1 from t2);
select * from t2 where DB_ROW_HASH_1 in (select DB_ROW_HASH_1 from t1);
--error ER_BAD_FIELD_ERROR
select DB_ROW_HASH_1 from t1,t2 where t1.DB_ROW_HASH_1 = t2.DB_ROW_HASH_2;
select DB_ROW_HASH_1 from t1 inner join t2 on t1.a = t2.DB_ROW_HASH_2;
drop table t1,t2;
--echo #long key unique with different key length
create table t1(a blob, unique(a(3000)));
desc t1;
show keys from t1;
show create table t1;
insert into t1 value(concat(repeat('s',3000),'1'));
--error ER_DUP_ENTRY
insert into t1 value(concat(repeat('s',3000),'2'));
update t1 set a= concat(repeat('s',3000),'2');
insert into t1 value(concat(repeat('a',3000),'2'));
drop table t1;
create table t1(a varchar(4000), b longblob , c varchar(5000), d longblob,
unique(a(3500), b), unique(c(4500), d));
desc t1;
show create table t1;
show keys from t1;
drop table t1;
--echo #ext bug
create table t1(a int primary key, b blob unique, c int, d blob , index(c));
show create table t1;
insert into t1 values(1,23,1,33);
--error ER_DUP_ENTRY
insert into t1 values(2,23,1,33);
drop table t1;
create table t2 (a blob unique , c int , index(c));
show create table t2;
insert into t2 values(1,1);
insert into t2 values(2,1);
drop table t2;
--echo #not null test
create table t1(a blob unique not null);
desc t1;
show create table t1;
insert into t1 values(1);
insert into t1 values(3);
--error ER_DUP_ENTRY
insert into t1 values(1);
drop table t1;
create table t1(a int primary key, b blob unique , c blob unique not null);
insert into t1 values(1,1,1);
--error ER_DUP_ENTRY
insert into t1 values(2,1,2);
--error ER_DUP_ENTRY
insert into t1 values(3,3,1);
drop table t1;
create table t1 (a blob unique not null, b blob not null, c blob not null, unique(b,c));
desc t1;
show create table t1;
insert into t1 values (1, 2, 3);
insert into t1 values (2, 1, 3);
--error ER_DUP_ENTRY
insert into t1 values (2, 1, 3);
drop table t1;
--echo #partition
--error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
create table t1(a blob unique) partition by hash(a);
--echo #key length > 2^16 -1
--error ER_TOO_LONG_KEYPART
create table t1(a blob, unique(a(65536)));
create table t1(a blob, unique(a(65535)));
show create table t1;
drop table t1;
--echo #64 indexes
--let $create_table=create table t1 (
--let $insert_data_1=insert into t1 values(
--let $insert_data_2=insert into t1 values(
--let $count= 63
--let $index= 0
while ($count)
{
--let $create_table=$create_table a$count blob unique,
--let $insert_data_1=$insert_data_1 $count,
--let $insert_data_2=$insert_data_2 $index,
--dec $count
--inc $index
}
--let $create_table=$create_table a blob unique);
--let $insert_data_1=$insert_data_1 0);
--let $insert_data_2=$insert_data_2 63);
--eval $create_table
--eval $insert_data_1
--error ER_DUP_ENTRY
--eval $insert_data_1
--eval $insert_data_2
--error ER_DUP_ENTRY
--eval $insert_data_2
drop table t1;
#
# non-unique long indexes are automatically shortened
#
create table t1(a blob , key(a));
show create table t1;
drop table t1;
create table t1(a blob);
alter table t1 add index(a);
show create table t1;
drop table t1;
create table t1(a text, key(a));
show create table t1;
drop table t1;
create table t1(a varchar(4000));
alter table t1 add index(a);
show create table t1;
drop table t1;
#
# somewhat inconsistently, the following is an error
#
create table t1 (pk int, a int, b int, primary key(pk), key(pk,a));
--error ER_TOO_LONG_KEY
alter table t1 modify a text;
--error ER_TOO_LONG_KEY
alter table t1 modify a varchar(1000);
show create table t1;
drop table t1;
--echo #
--echo # MDEV-19705: Assertion `tmp >= 0' failed in best_access_path
--echo #
CREATE TABLE t1 (d varchar(10)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('a'),('q');
CREATE TABLE t2 (f varchar(10), a2 datetime, b int, a1 varchar(1024), pk int NOT NULL, PRIMARY KEY (pk), UNIQUE KEY (f,a1,a2), KEY f2 (f(4),a2)) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('aaa','1985-09-06',-163,'s',1),('bbb','1995-01-05',3,'pucaz',2),('ccc','0000-00-00',NULL,'help',3),('ddd',NULL,618,'v',4),('eee','1995-12-20',410,'m',5),('ffq','1976-06-12 20:02:56',NULL,'POKNC',6),('dddd','0000-00-00',-328,'hgsu',7);
explain
SELECT t2.b FROM t1 JOIN t2 ON t1.d = t2.f WHERE t2.pk >= 20;
SELECT t2.b FROM t1 JOIN t2 ON t1.d = t2.f WHERE t2.pk >= 20;
drop table t1,t2;
--echo # End of 10.4 tests
--echo #
--echo # MDEV-21470 MyISAM start_bulk_insert doesn't work with long unique
--echo #
CREATE TABLE t1 (a INT, b BLOB) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
CREATE TABLE t2 (c BIT, d BLOB, UNIQUE(d)) ENGINE=MyISAM;
INSERT INTO t2 SELECT * FROM t1;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-19338 Using AUTO_INCREMENT with long unique
--echo #
--error ER_NO_AUTOINCREMENT_WITH_UNIQUE
CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam;
--echo #
--echo # MDEV-35620 UBSAN: runtime error: applying zero offset to null pointer in _ma_unique_hash, skip_trailing_space, my_hash_sort_mb_nopad_bin and my_strnncollsp_utf8mb4_bin
--echo #
--echo # Disable result log. The exact result is not important.
--echo # We just need to make sure UBSAN nullptr-with-offset is not reported.
--disable_result_log
SELECT DISTINCT user,authentication_string FROM mysql.user;
SELECT DISTINCT USER,PASSWORD FROM mysql.user;
SELECT DISTINCT USER,plugin FROM mysql.user;
--enable_result_log
--echo # Enabling result log again.
create or replace table t1 (t text) engine=aria;
insert into t1 values ('');
insert into t1 values (NULL);
select distinct t from t1;
alter table t1 ENGINE=MyISAM;
select distinct t from t1;
DROP TABLE t1;
--echo # End of 10.5 tests
|