From efd87bebae953fbf955de0723b106f623ce6312d Mon Sep 17 00:00:00 2001 From: Sachin Date: Thu, 3 Jan 2019 16:42:12 +0530 Subject: Random fixes --- mysql-test/main/long_unique.result | 5 +++++ mysql-test/main/long_unique.test | 5 +++++ mysql-test/main/type_blob.result | 2 +- mysql-test/main/type_blob.test | 4 +++- 4 files changed, 14 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/main/long_unique.result b/mysql-test/main/long_unique.result index 994f1b4c3f9..47d3ec988ba 100644 --- a/mysql-test/main/long_unique.result +++ b/mysql-test/main/long_unique.result @@ -7,6 +7,11 @@ set @allowed_packet= @@max_allowed_packet; #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); +#blob with primary key not allowed +create table t2(a blob,primary key(a(10000))); +ERROR 42000: Specified key was too long; max key length is 1000 bytes +create table t3(a varchar(10000) primary key); +ERROR 42000: Specified key was too long; max key length is 1000 bytes insert into t1 values(2); ERROR 23000: Duplicate entry '2' for key 'a' #table structure; diff --git a/mysql-test/main/long_unique.test b/mysql-test/main/long_unique.test index 52e91d1f182..41c18178ae5 100644 --- a/mysql-test/main/long_unique.test +++ b/mysql-test/main/long_unique.test @@ -9,6 +9,11 @@ set @allowed_packet= @@max_allowed_packet; --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); diff --git a/mysql-test/main/type_blob.result b/mysql-test/main/type_blob.result index 3c99366168c..5f9fe0131ab 100644 --- a/mysql-test/main/type_blob.result +++ b/mysql-test/main/type_blob.result @@ -370,7 +370,7 @@ a 1 hello 1 drop table t1; create table t1 (a text, unique (a(2100))); -ERROR 42000: Specified key was too long; max key length is 1000 bytes +drop table t1; create table t1 (a text, key (a(2100))); Warnings: Note 1071 Specified key was too long; max key length is 1000 bytes diff --git a/mysql-test/main/type_blob.test b/mysql-test/main/type_blob.test index 2c74d4ea241..e60de526300 100644 --- a/mysql-test/main/type_blob.test +++ b/mysql-test/main/type_blob.test @@ -131,8 +131,10 @@ select c,count(*) from t1 group by c; select d,count(*) from t1 group by d; drop table t1; --- error 1071 +#-- error 1071 +#After index on long unique this will work create table t1 (a text, unique (a(2100))); # should give an error +drop table t1; create table t1 (a text, key (a(2100))); # key is auto-truncated show create table t1; drop table t1; -- cgit v1.2.1