mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-28912 NON-UNIQUE FTS_DOC_ID index mistaken as FTS_DOC_ID_INDEX
- InnoDB mistakenly identifies the non-unique FTS_DOC_ID index as FTS_DOC_ID_INDEX while loading the table. dict_load_indexes() should check whether the index is unique before assigning fts_doc_id_index
This commit is contained in:
committed by
Marko Mäkelä
parent
7c35ad16e3
commit
990cde800a
@@ -271,3 +271,10 @@ fts_doc_id first_name last_name score
|
||||
6 Ned Flanders 0
|
||||
7 Nelson Muntz 0
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
KEY FTS_DOC_ID_INDEX(FTS_DOC_ID))ENGINE=InnoDB;
|
||||
ALTER TABLE t1 ADD COLUMN c INT as (a) VIRTUAL;
|
||||
ALTER TABLE t1 ADD d INT NULL;
|
||||
ALTER TABLE t1 ADD FULLTEXT(b);
|
||||
ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -257,3 +257,14 @@ INSERT INTO t1 (id, first_name, last_name) VALUES
|
||||
analyze table t1;
|
||||
SELECT fts_doc_id, first_name, last_name, MATCH(first_name) AGAINST('Homer' IN BOOLEAN MODE) AS score FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# MDEV-28912 NON-UNIQUE FTS_DOC_ID mistaken as FTS_DOC_ID_INDEX
|
||||
#
|
||||
CREATE TABLE t1(a INT, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
KEY FTS_DOC_ID_INDEX(FTS_DOC_ID))ENGINE=InnoDB;
|
||||
ALTER TABLE t1 ADD COLUMN c INT as (a) VIRTUAL;
|
||||
ALTER TABLE t1 ADD d INT NULL;
|
||||
--error ER_INNODB_FT_WRONG_DOCID_INDEX
|
||||
ALTER TABLE t1 ADD FULLTEXT(b);
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -2590,8 +2590,11 @@ next_rec:
|
||||
ut_ad(table->fts_doc_id_index == NULL);
|
||||
|
||||
if (table->fts != NULL) {
|
||||
table->fts_doc_id_index = dict_table_get_index_on_name(
|
||||
dict_index_t *idx = dict_table_get_index_on_name(
|
||||
table, FTS_DOC_ID_INDEX_NAME);
|
||||
if (idx && dict_index_is_unique(idx)) {
|
||||
table->fts_doc_id_index = idx;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the table contains FTS indexes, populate table->fts->indexes */
|
||||
|
||||
Reference in New Issue
Block a user