summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSachin <sachin.setiya@mariadb.com>2018-12-31 10:05:19 +0530
committerSachin <sachin.setiya@mariadb.com>2018-12-31 20:35:38 +0530
commite94320a36b07565d46dc98c36d7de9d32d6b0c4c (patch)
treec80b577c474e56c20e93b0704e932a3aa9b0a4ae /mysql-test
parent1e9279a8bd5ecad51238e2759f317baf457f0006 (diff)
downloadmariadb-git-e94320a36b07565d46dc98c36d7de9d32d6b0c4c.tar.gz
Architecture change final
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/long_unique.result32
-rw-r--r--mysql-test/main/long_unique.test12
-rw-r--r--mysql-test/main/long_unique_update.result9
-rw-r--r--mysql-test/main/long_unique_update.test1
4 files changed, 29 insertions, 25 deletions
diff --git a/mysql-test/main/long_unique.result b/mysql-test/main/long_unique.result
index c8b44b35cb7..994f1b4c3f9 100644
--- a/mysql-test/main/long_unique.result
+++ b/mysql-test/main/long_unique.result
@@ -2,11 +2,13 @@
#First we will check all option for
#table containing single unique column
#table containing keys like unique(a,b,c,d) etc
-#then table containing 2 blob unique etc
+#then table containing 2 blob unique etc
set @allowed_packet= @@max_allowed_packet;
-#table with single long blob column;
-create table t1(a blob unique);
+#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);
+insert into t1 values(2);
+ERROR 23000: Duplicate entry '2' for key 'a'
#table structure;
desc t1;
Field Type Null Key Default Extra
@@ -40,7 +42,7 @@ Recordlength: 20
table description:
Key Start Len Index Type
-1 12 8 multip. ulonglong NULL
+1 12 8 unique ulonglong NULL
select * from information_schema.columns where table_schema = 'test' and table_name = 't1';
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 PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
def test t1 a 1 NULL YES blob 65535 65535 NULL NULL NULL NULL NULL blob UNI select,insert,update,references NEVER NULL
@@ -128,7 +130,7 @@ Recordlength: 20
table description:
Key Start Len Index Type
-1 12 8 multip. ulonglong NULL
+1 12 8 unique ulonglong NULL
#now some alter commands;
alter table t1 add column b int;
desc t1;
@@ -322,7 +324,7 @@ ERROR 23000: Duplicate entry '1' for key 'b'
insert into t1 values(7,1);
ERROR 23000: Duplicate entry '1' for key 'b'
drop table t1;
-#table with multiple long blob column and varchar text column ;
+#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);
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'),
@@ -364,10 +366,10 @@ Recordlength: 3072
table description:
Key Start Len Index Type
-1 3063 8 multip. ulonglong NULL
-2 3055 8 multip. ulonglong NULL
-3 3047 8 multip. ulonglong NULL
-4 3039 8 multip. ulonglong NULL
+1 3063 8 unique ulonglong NULL
+2 3055 8 unique ulonglong NULL
+3 3047 8 unique ulonglong NULL
+4 3039 8 unique ulonglong NULL
select * from information_schema.columns where table_schema = 'test' and table_name = 't1';
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 PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
def test t1 a 1 NULL YES blob 65535 65535 NULL NULL NULL NULL NULL blob UNI select,insert,update,references NEVER NULL
@@ -522,7 +524,7 @@ g int(11) YES NULL
db_row_hash_1 int(11) YES UNI NULL
db_row_hash_2 int(11) YES UNI NULL
db_row_hash_5 int(11) YES NULL
-#this show now break anything;
+#this should not break anything;
insert into t1 values(1,2,3,4,5,6,23,5,6);
ERROR 23000: Duplicate entry '1' for key 'a'
#this should also drop the unique index;
@@ -721,10 +723,10 @@ Recordlength: 5092
table description:
Key Start Len Index Type
-1 5081 8 multip. ulonglong NULL
-2 5073 8 multip. ulonglong NULL
-3 5065 8 multip. ulonglong NULL
-4 5057 8 multip. ulonglong NULL
+1 5081 8 unique ulonglong NULL
+2 5073 8 unique ulonglong NULL
+3 5065 8 unique ulonglong NULL
+4 5057 8 unique ulonglong NULL
select * from information_schema.columns where table_schema = 'test' and table_name = 't1';
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 PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
def test t1 a 1 NULL YES blob 65535 65535 NULL NULL NULL NULL NULL blob MUL select,insert,update,references NEVER NULL
diff --git a/mysql-test/main/long_unique.test b/mysql-test/main/long_unique.test
index 65fcdfcc9e4..52e91d1f182 100644
--- a/mysql-test/main/long_unique.test
+++ b/mysql-test/main/long_unique.test
@@ -4,13 +4,14 @@ let datadir=`select @@datadir`;
--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 #then table containing 2 blob unique etc
set @allowed_packet= @@max_allowed_packet;
-
---echo #table with single long blob column;
-create table t1(a blob unique);
+--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);
+--error ER_DUP_ENTRY
+insert into t1 values(2);
--echo #table structure;
desc t1;
show create table t1;
@@ -125,7 +126,7 @@ insert into t1 values(1,1);
insert into t1 values(7,1);
drop table t1;
---echo #table with multiple long blob column and varchar text column ;
+--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);
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'),
@@ -224,7 +225,6 @@ 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));
diff --git a/mysql-test/main/long_unique_update.result b/mysql-test/main/long_unique_update.result
index fd826198179..7c3a5ce1445 100644
--- a/mysql-test/main/long_unique_update.result
+++ b/mysql-test/main/long_unique_update.result
@@ -254,10 +254,11 @@ ERROR 23000: Duplicate entry '2-2' for key 'b'
update t1 set b=b+34, c=c+34 where e=1 and g=1 ;
update t1 set b=35, c=35 where e=1 and g=1 ;
update t1 set b=b+1, c=c+1 where a>0;
+ERROR 23000: Duplicate entry '3-3' for key 'b'
update ignore t1 set b=b+1, c=c+1 where a>0;
select * from t1 ;
a b c d e f g
-1 35 35 1 1 1 1
+1 37 37 1 1 1 1
2 2 2 2 2 2 2
3 3 3 3 3 3 3
4 4 4 4 4 4 4
@@ -265,7 +266,7 @@ a b c d e f g
6 6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8
-9 9 9 9 9 9 9
+9 10 10 9 9 9 9
truncate table t1;
insert into t1 values(1,1,1,1,1,1,1),(2,2,2,2,2,2,2),(3,3,3,3,3,3,3),(4,4,4,4,4,4,4),
(5,5,5,5,5,5,5),(6,6,6,6,6,6,6),(7,7,7,7,7,7,7),(8,8,8,8,8,8,8),(9,9,9,9,9,9,9);
@@ -304,7 +305,7 @@ ERROR 23000: Duplicate entry '3-3' for key 'e'
update ignore t1 set e=e+1, g=g+1 where a>0;
select * from t1 ;
a b c d e f g
-1 1 1 1 36 1 36
+1 1 1 1 37 1 37
2 2 2 2 2 2 2
3 3 3 3 3 3 3
4 4 4 4 4 4 4
@@ -312,5 +313,5 @@ a b c d e f g
6 6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8
-9 9 9 9 9 9 9
+9 9 9 9 10 9 10
drop table t1;
diff --git a/mysql-test/main/long_unique_update.test b/mysql-test/main/long_unique_update.test
index 79cca079fe6..b160ebad9f1 100644
--- a/mysql-test/main/long_unique_update.test
+++ b/mysql-test/main/long_unique_update.test
@@ -106,6 +106,7 @@ select * from t1 limit 3;
update t1 set b=2 ,c=2 where a=1;
update t1 set b=b+34, c=c+34 where e=1 and g=1 ;
update t1 set b=35, c=35 where e=1 and g=1 ;
+--error ER_DUP_ENTRY
update t1 set b=b+1, c=c+1 where a>0;
update ignore t1 set b=b+1, c=c+1 where a>0;
select * from t1 ;