1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

if a key length exceeds the supported maximum and it is safe to auto-decrease it, do it.

include/my_global.h:
  do macro correctly
mysql-test/r/ctype_utf8.result:
  updated
mysql-test/r/myisam.result:
  updated
mysql-test/r/type_blob.result:
  updated
mysql-test/t/ctype_utf8.test:
  updated
mysql-test/t/type_blob.test:
  new tests
sql/share/english/errmsg.txt:
  specify that max key length is in BYTES
sql/share/russian/errmsg.txt:
  specify that max key length is in BYTES
sql/share/ukrainian/errmsg.txt:
  specify that max key length is in BYTES
sql/sql_table.cc:
  if a key length exceeds the supported maximum and it is safe to auto-decrease it, do it.
  cleanup
This commit is contained in:
unknown
2004-02-17 16:57:39 +01:00
parent 66a266203f
commit a0040b0bda
10 changed files with 66 additions and 35 deletions

View File

@ -168,4 +168,4 @@ hex(s1)
41
drop table t1;
create table t1 (a char(160) character set utf8, primary key(a));
ERROR HY000: Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the storage engine doesn't support unique sub keys
ERROR 42000: Specified key was too long; max key length is 255 bytes

View File

@ -323,10 +323,10 @@ Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
ERROR 42000: Specified key was too long. Max key length is 500
ERROR 42000: Specified key was too long; max key length is 500 bytes
CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
ALTER TABLE t1 ADD INDEX t1 (a, b, c);
ERROR 42000: Specified key was too long. Max key length is 500
ERROR 42000: Specified key was too long; max key length is 500 bytes
DROP TABLE t1;
CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a));
INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4);

View File

@ -346,9 +346,17 @@ HELLO MY 1
a 1
hello 1
drop table t1;
create table t1 (a text, unique (a(300)));
ERROR 42000: Specified key was too long; max key length is 255 bytes
create table t1 (a text, key (a(300)));
ERROR HY000: Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the storage engine doesn't support unique sub keys
create table t1 (a text, key (a(255)));
Warnings:
Warning 1071 Specified key was too long; max key length is 255 bytes
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text,
KEY `a` (`a`(255))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 (
t1_id bigint(21) NOT NULL auto_increment,

View File

@ -103,5 +103,5 @@ drop table t1;
# Bug 2699
# UTF8 breaks primary keys for cols > 85 characters
#
--error 1089
--error 1071
create table t1 (a char(160) character set utf8, primary key(a));

View File

@ -121,8 +121,10 @@ select c,count(*) from t1 group by c;
select d,count(*) from t1 group by d;
drop table t1;
!$1089 create table t1 (a text, key (a(300))); # should give an error
create table t1 (a text, key (a(255)));
-- error 1071
create table t1 (a text, unique (a(300))); # should give an error
create table t1 (a text, key (a(300))); # key is auto-truncated
show create table t1;
drop table t1;
#