mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-33658 1/2 Refactoring: extract Key length initialization
mysql_prepare_create_table: Extract a Key initialization part that relates to length calculation and long unique index designation. append_system_key_parts call also moves there. Move this initialization before the duplicate elimination. Extract WITHOUT OVERPLAPS check into a separate function. It had to be moved earlier in the code to preserve the order of the error checks, as in the tests.
This commit is contained in:
@@ -38,7 +38,7 @@ CREATE TABLE t_stmt (a VARCHAR(100)) ENGINE = EXAMPLE;
|
||||
ALTER TABLE t_stmt ADD COLUMN b INT;
|
||||
CREATE TRIGGER trig_stmt BEFORE INSERT ON t_stmt FOR EACH ROW INSERT INTO t_stmt VALUES (1);
|
||||
CREATE INDEX i ON t_stmt(a);
|
||||
ERROR 42000: Too many key parts specified; max 0 parts allowed
|
||||
ERROR 42000: Specified key was too long; max key length is 0 bytes
|
||||
CREATE TABLE t_stmt_new ENGINE = EXAMPLE SELECT * FROM t_stmt;
|
||||
ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging
|
||||
DROP TABLE t_stmt;
|
||||
|
@@ -75,7 +75,7 @@ ALTER TABLE t_stmt ADD COLUMN b INT;
|
||||
|
||||
CREATE TRIGGER trig_stmt BEFORE INSERT ON t_stmt FOR EACH ROW INSERT INTO t_stmt VALUES (1);
|
||||
|
||||
--error ER_TOO_MANY_KEY_PARTS
|
||||
--error ER_TOO_LONG_KEY
|
||||
CREATE INDEX i ON t_stmt(a);
|
||||
|
||||
--error ER_BINLOG_ROW_MODE_AND_STMT_ENGINE
|
||||
|
@@ -659,6 +659,8 @@ NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 15000
|
||||
NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 16000
|
||||
ALTER TABLE testdb_wl5522.t1 ADD INDEX idx1 (col_1);
|
||||
ALTER TABLE testdb_wl5522.t1 ADD INDEX idx6 (col_1(255));
|
||||
Warnings:
|
||||
Note 1831 Duplicate index `idx6`. This is deprecated and will be disallowed in a future release
|
||||
ALTER TABLE testdb_wl5522.t1 ADD INDEX idx10 (col_10(255));
|
||||
SELECT
|
||||
col_1 = REPEAT("col1_00001",10),
|
||||
|
@@ -1075,6 +1075,8 @@ col1 POINT,
|
||||
col2 POINT
|
||||
);
|
||||
CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
|
||||
ERROR 42000: Key column 'col1' doesn't exist in table
|
||||
CREATE SPATIAL INDEX idx0 ON t2 (col0, col2);
|
||||
ERROR HY000: Incorrect arguments to SPATIAL INDEX
|
||||
CREATE TABLE t4 (
|
||||
col0 INTEGER NOT NULL,
|
||||
|
@@ -1562,7 +1562,7 @@ ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
|
||||
ERROR HY000: Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 150 Alter table `test`.`child` with foreign key (p) constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns.
|
||||
Warning 150 Alter table `test`.`child` with foreign key (p) constraint failed. There is only prefix index in the referenced table where the referenced columns appear as the first columns.
|
||||
Error 1005 Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||
Warning 1215 Cannot add foreign key constraint for `child`
|
||||
ALTER TABLE parent DROP INDEX idx1;
|
||||
@@ -1570,7 +1570,7 @@ ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
|
||||
Got one of the listed errors
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Warning 150 Alter table `test`.`child` with foreign key (p) constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns.
|
||||
Warning 150 Alter table `test`.`child` with foreign key (p) constraint failed. There is only prefix index in the referenced table where the referenced columns appear as the first columns.
|
||||
Error 1005 Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed")
|
||||
Warning 1215 Cannot add foreign key constraint for `child`
|
||||
ALTER TABLE child DROP INDEX idx2;
|
||||
|
@@ -839,8 +839,10 @@ CREATE TABLE t3 (
|
||||
);
|
||||
|
||||
# --error ER_TOO_MANY_KEY_PARTS
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
|
||||
--error ER_WRONG_ARGUMENTS
|
||||
CREATE SPATIAL INDEX idx0 ON t2 (col0, col2);
|
||||
|
||||
|
||||
CREATE TABLE t4 (
|
||||
|
@@ -171,9 +171,11 @@ Note 1071 Specified key was too long; max key length is 1536 bytes
|
||||
create index idx3 on worklog5743_8(a2(3072));
|
||||
Warnings:
|
||||
Note 1071 Specified key was too long; max key length is 1536 bytes
|
||||
Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release
|
||||
show warnings;
|
||||
Level Code Message
|
||||
Note 1071 Specified key was too long; max key length is 1536 bytes
|
||||
Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release
|
||||
create index idx4 on worklog5743_8(a1, a2(1533));
|
||||
ERROR 42000: Specified key was too long; max key length is 1536 bytes
|
||||
show warnings;
|
||||
@@ -355,6 +357,7 @@ Note 1071 Specified key was too long; max key length is 1536 bytes
|
||||
create index idx2 on worklog5743(a(3072));
|
||||
Warnings:
|
||||
Note 1071 Specified key was too long; max key length is 1536 bytes
|
||||
Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release
|
||||
SET sql_mode= default;
|
||||
show create table worklog5743;
|
||||
Table Create Table
|
||||
|
Reference in New Issue
Block a user