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
|
--source include/have_debug.inc
#
# MDEV-371 Unique indexes for blobs
#
--echo #In this test case we will check what will happen in the case of hash collision
SET debug_dbug="d,same_long_unique_hash";
create table t1(a blob unique);
FLUSH STATUS;
insert into t1 values('xyz');
insert into t1 values('abc');
insert into t1 values('sachin');
--error ER_DUP_ENTRY
insert into t1 values('sachin');
insert into t1 values('maria');
--error ER_DUP_ENTRY
insert into t1 values('maria');
drop table t1;
SHOW STATUS LIKE 'handler_read_next';
SET debug_dbug="";
create table t1(a blob unique);
FLUSH STATUS;
insert into t1 values('xyz');
insert into t1 values('abc');
insert into t1 values('sachin');
--error ER_DUP_ENTRY
insert into t1 values('sachin');
insert into t1 values('maria');
--error ER_DUP_ENTRY
insert into t1 values('maria');
drop table t1;
SHOW STATUS LIKE 'handler_read_next';
SET debug_dbug="d,same_long_unique_hash";
create table t1(a blob unique, b blob unique);
insert into t1 values('xyz', 11);
insert into t1 values('abc', 22);
insert into t1 values('sachin', 1);
--error ER_DUP_ENTRY
insert into t1 values('sachin', 4);
insert into t1 values('maria', 2);
--error ER_DUP_ENTRY
insert into t1 values('maria', 3);
drop table t1;
create table t1(a blob , b blob , unique(a,b));
insert into t1 values('xyz', 11);
insert into t1 values('abc', 22);
insert into t1 values('sachin', 1);
--error ER_DUP_ENTRY
insert into t1 values('sachin', 1);
insert into t1 values('maria', 2);
--error ER_DUP_ENTRY
insert into t1 values('maria', 2);
drop table t1;
--echo ##Internal State of long unique tables
SET debug_dbug="d,print_long_unique_internal_state";
create table t1 ( a blob unique);
SET debug_dbug="";
drop table t1;
SET debug_dbug="d,print_long_unique_internal_state";
create table t1 ( a blob unique, b blob unique , c blob unique);
SET debug_dbug="";
drop table t1;
SET debug_dbug="d,print_long_unique_internal_state";
create table t1 ( a blob , b blob , c blob , d blob , unique (a,b), unique(c, d));
SET debug_dbug="";
drop table t1;
SET debug_dbug="d,print_long_unique_internal_state";
create table t1(a int primary key, b blob unique , c blob unique not null);
SET debug_dbug="";
drop table t1;
--echo ##Using hash
SET debug_dbug="d,print_long_unique_internal_state";
create table t1(a int ,b int , c int, unique(a, b, c) using hash);
SET debug_dbug="";
drop table t1;
--echo ##Using hash but with memory engine so no long unique column
SET debug_dbug="d,print_long_unique_internal_state";
create table t1(a int ,b int , c int, unique(a, b, c) using hash) engine=memory;
SET debug_dbug="";
drop table t1;
|