diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-04-03 17:18:37 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-04-07 09:55:54 +0200 |
commit | 82196f0131a26c0f72e7452ff172eb2f93067efd (patch) | |
tree | e122314d7c335aefaffc2e48ee81c18f90c4f158 | |
parent | 30cbbfbf774b4795ac70d7ca333f37f402a9184d (diff) | |
download | mariadb-git-82196f0131a26c0f72e7452ff172eb2f93067efd.tar.gz |
MDEV-11995 ALTER TABLE proceeds despite reporting ER_TOO_LONG_KEY error
automatic shortening of a too-long non-unique key should
be not a warning, but a note. It's a normal optimization,
doesn't affect correctness, and should never be converted to
an error, no matter how strict sql_mode is.
-rw-r--r-- | mysql-test/r/ctype_utf8mb4.result | 2 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8mb4_innodb.result | 2 | ||||
-rw-r--r-- | mysql-test/r/ctype_utf8mb4_myisam.result | 2 | ||||
-rw-r--r-- | mysql-test/r/type_blob.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/alter_table.result | 13 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/innodb.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/alter_table.test | 10 | ||||
-rw-r--r-- | mysql-test/suite/innodb_zip/r/index_large_prefix.result | 34 | ||||
-rw-r--r-- | mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result | 34 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 |
10 files changed, 64 insertions, 41 deletions
diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result index cb2f93dec30..d74cfd4dd3f 100644 --- a/mysql-test/r/ctype_utf8mb4.result +++ b/mysql-test/r/ctype_utf8mb4.result @@ -2387,7 +2387,7 @@ PRIMARY KEY (clipid), KEY tape(Tape(255)) ) CHARACTER SET=utf8mb4; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid; SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/r/ctype_utf8mb4_innodb.result b/mysql-test/r/ctype_utf8mb4_innodb.result index 28ed7ed313d..11d89154269 100644 --- a/mysql-test/r/ctype_utf8mb4_innodb.result +++ b/mysql-test/r/ctype_utf8mb4_innodb.result @@ -2347,7 +2347,7 @@ PRIMARY KEY (clipid), KEY tape(Tape(255)) ) CHARACTER SET=utf8mb4 ENGINE InnoDB; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid; SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/r/ctype_utf8mb4_myisam.result b/mysql-test/r/ctype_utf8mb4_myisam.result index 2c798102e50..ef7bda0a79b 100644 --- a/mysql-test/r/ctype_utf8mb4_myisam.result +++ b/mysql-test/r/ctype_utf8mb4_myisam.result @@ -2347,7 +2347,7 @@ PRIMARY KEY (clipid), KEY tape(Tape(255)) ) CHARACTER SET=utf8mb4 ENGINE MyISAM; Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid; SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index b2fe974acdb..569ba65df3f 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -373,7 +373,7 @@ create table t1 (a text, unique (a(2100))); ERROR 42000: Specified key was too long; max key length is 1000 bytes create table t1 (a text, key (a(2100))); Warnings: -Warning 1071 Specified key was too long; max key length is 1000 bytes +Note 1071 Specified key was too long; max key length is 1000 bytes show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result new file mode 100644 index 00000000000..304bc865f75 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_table.result @@ -0,0 +1,13 @@ +set @@sql_mode=strict_trans_tables; +create table t1(a text not null) row_format=dynamic engine=innodb; +create index idx1 on t1(a(3073)); +Warnings: +Note 1071 Specified key was too long; max key length is 3072 bytes +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` text NOT NULL, + KEY `idx1` (`a`(3072)) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +drop table t1; +set @@sql_mode=default; diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 1b62854efef..2ce73304281 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -2543,11 +2543,11 @@ Warning 1071 Specified key was too long; max key length is 767 bytes create table t3 (col1 text, index(col1(768))) character set = latin1 engine = innodb; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes create table t4 (col1 blob, index(col1(768))) character set = latin1 engine = innodb; Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes SET GLOBAL innodb_large_prefix=default; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test new file mode 100644 index 00000000000..13fb574972a --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_table.test @@ -0,0 +1,10 @@ +--source include/have_innodb.inc +# +# MDEV-11995 ALTER TABLE proceeds despite reporting ER_TOO_LONG_KEY error +# +set @@sql_mode=strict_trans_tables; +create table t1(a text not null) row_format=dynamic engine=innodb; +create index idx1 on t1(a(3073)); +show create table t1; +drop table t1; +set @@sql_mode=default; diff --git a/mysql-test/suite/innodb_zip/r/index_large_prefix.result b/mysql-test/suite/innodb_zip/r/index_large_prefix.result index 4e57b27dec8..df177e8ea2a 100644 --- a/mysql-test/suite/innodb_zip/r/index_large_prefix.result +++ b/mysql-test/suite/innodb_zip/r/index_large_prefix.result @@ -101,7 +101,7 @@ create index idx1 on worklog5743_1(a2(4000)); Got one of the listed errors show warnings; Level Code Message -Error 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs set global innodb_large_prefix=1; Warnings: @@ -110,7 +110,7 @@ create index idx2 on worklog5743_1(a2(4000)); Got one of the listed errors show warnings; Level Code Message -Error 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_1(a2(436)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -134,10 +134,10 @@ Warning 131 Using innodb_large_prefix is deprecated and the parameter may be rem SET sql_mode= ''; create index idx1 on worklog5743_2(a2(4000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html @@ -145,7 +145,7 @@ create index idx2 on worklog5743_2(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_2(a2(948)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -168,10 +168,10 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_4(a2(4000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html @@ -179,7 +179,7 @@ create index idx2 on worklog5743_4(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_4(a2(1972)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -202,19 +202,19 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_8(a2(1000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx2 on worklog5743_8(a2(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_8(a2(3072)); Warnings: Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release @@ -242,19 +242,19 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_16(a2(1000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx2 on worklog5743_16(a2(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_16(a2(3072)); Warnings: Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release @@ -508,7 +508,7 @@ create table worklog5743(a TEXT not null) ROW_FORMAT=DYNAMIC; SET sql_mode=''; create index idx1 on worklog5743(a(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx2 on worklog5743(a(3072)); Warnings: Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release diff --git a/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result b/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result index 20deee57d46..5be18b84065 100644 --- a/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result +++ b/mysql-test/suite/innodb_zip/r/innodb_index_large_prefix.result @@ -106,7 +106,7 @@ create index idx1 on worklog5743_1(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs set global innodb_large_prefix=1; Warnings: @@ -115,7 +115,7 @@ create index idx2 on worklog5743_1(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_1(a2(436)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -138,10 +138,10 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_2(a2(4000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html @@ -149,7 +149,7 @@ create index idx2 on worklog5743_2(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_2(a2(948)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -172,10 +172,10 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_4(a2(4000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html @@ -183,7 +183,7 @@ create index idx2 on worklog5743_4(a2(4000)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs create index idx3 on worklog5743_4(a2(1972)); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs @@ -206,19 +206,19 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_8(a2(1000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx2 on worklog5743_8(a2(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_8(a2(3072)); Warnings: Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release @@ -246,19 +246,19 @@ Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx1 on worklog5743_16(a2(1000)); Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 767 bytes +Note 1071 Specified key was too long; max key length is 767 bytes set global innodb_large_prefix=1; Warnings: Warning 131 Using innodb_large_prefix is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create index idx2 on worklog5743_16(a2(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes show warnings; Level Code Message -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx3 on worklog5743_16(a2(3072)); Warnings: Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release @@ -510,7 +510,7 @@ create table worklog5743(a TEXT not null) ROW_FORMAT=DYNAMIC; set statement sql_mode = '' for create index idx1 on worklog5743(a(3073)); Warnings: -Warning 1071 Specified key was too long; max key length is 3072 bytes +Note 1071 Specified key was too long; max key length is 3072 bytes create index idx2 on worklog5743(a(3072)); Warnings: Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release diff --git a/sql/sql_table.cc b/sql/sql_table.cc index baab8e320a0..f5f2ffb0b63 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3949,7 +3949,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (key->type == Key::MULTIPLE) { /* not a critical problem */ - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_TOO_LONG_KEY, ER_THD(thd, ER_TOO_LONG_KEY), key_part_length); |