| 1 |
--echo # |
| 2 |
--echo # Bug#32831765 CREATE FULLTEXT INDEX fails with ERROR 1062 (23000): |
| 3 |
--echo # Duplicate entry 'NULL-NULL' |
| 4 |
--echo # |
| 5 |
|
| 6 |
# Conditions for reproduction: |
| 7 |
# - multiple columns covered fulltext index |
| 8 |
# - same token at same offset in more than one column in the same row |
| 9 |
|
| 10 |
CREATE TABLE tt ( |
| 11 |
`col1` varchar(255) DEFAULT NULL, |
| 12 |
`col2` varchar(255) DEFAULT NULL |
| 13 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; |
| 14 |
|
| 15 |
DELIMITER %; |
| 16 |
|
| 17 |
# Failure is non-deterministic ant time sensitive, but reproduction was found |
| 18 |
# to be reliable given enough rows |
| 19 |
CREATE PROCEDURE populate() |
| 20 |
BEGIN |
| 21 |
SET @rows = 30000; |
| 22 |
REPEAT |
| 23 |
INSERT INTO tt (col1, col2) VALUES ( |
| 24 |
'tokens which repeat in the the first and second columns at the same positions', |
| 25 |
'tokens which repeat in the the first and second columns at the same positions' |
| 26 |
); |
| 27 |
SET @rows = @rows-1; |
| 28 |
UNTIL @rows=0 END REPEAT; |
| 29 |
END% |
| 30 |
|
| 31 |
DELIMITER ;% |
| 32 |
|
| 33 |
CALL POPULATE; |
| 34 |
|
| 35 |
CREATE FULLTEXT INDEX search ON tt (col1, col2); |
| 36 |
|
| 37 |
DROP PROCEDURE populate; |
| 38 |
DROP TABLE tt; |