1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.4' into 10.5

This commit is contained in:
Sergei Golubchik
2023-12-01 13:43:58 +01:00
511 changed files with 26233 additions and 3853 deletions

View File

@@ -1090,3 +1090,59 @@ ALTER TABLE t1 ADD COLUMN b DATETIME NOT NULL, LOCK=NONE;
# Cleanup
SET @@SQL_MODE= @OLD_SQL_MODE;
DROP TABLE t1;
#
# Bug#20977779 CANNOT IMPORT TABLES CONTAINING PREFIX INDEXES
#
CREATE TABLE t1 (c1 VARCHAR(32), c2 VARCHAR(32), c3 VARCHAR(32),
PRIMARY KEY (c1, c2, c3))
ENGINE=InnoDB;
ALTER TABLE t1 ADD INDEX ind1(c1(5), c2, c3);
ALTER TABLE t1 ADD INDEX ind2(c3, c1(10), c2);
ALTER TABLE t1 ADD INDEX ind3(c2, c3, c1(20));
INSERT INTO t1 VALUES ('Test Data -1', 'Test Data -2', 'Test Data -3');
# Test with 2ndary index having prefix
FLUSH TABLES test.t1 FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE test.t1 DISCARD TABLESPACE;
ALTER TABLE test.t1 IMPORT TABLESPACE;
CHECK TABLE test.t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(32) NOT NULL,
`c2` varchar(32) NOT NULL,
`c3` varchar(32) NOT NULL,
PRIMARY KEY (`c1`,`c2`,`c3`),
KEY `ind1` (`c1`(5),`c2`,`c3`),
KEY `ind2` (`c3`,`c1`(10),`c2`),
KEY `ind3` (`c2`,`c3`,`c1`(20))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT * FROM test.t1;
c1 c2 c3
Test Data -1 Test Data -2 Test Data -3
# Test with PK & 2ndary index with prefix
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c1(5), c2(10), c3(20));
FLUSH TABLES test.t1 FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE test.t1 DISCARD TABLESPACE;
ALTER TABLE test.t1 IMPORT TABLESPACE;
CHECK TABLE test.t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(32) NOT NULL,
`c2` varchar(32) NOT NULL,
`c3` varchar(32) NOT NULL,
PRIMARY KEY (`c1`(5),`c2`(10),`c3`(20)),
KEY `ind1` (`c1`(5),`c2`,`c3`),
KEY `ind2` (`c3`,`c1`(10),`c2`),
KEY `ind3` (`c2`,`c3`,`c1`(20))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT * FROM test.t1;
c1 c2 c3
Test Data -1 Test Data -2 Test Data -3
DROP TABLE t1;