Error
Error Code:
1798
MariaDB Error 1798: Incorrect FULLTEXT Index Type
Description
Error 1798 indicates an attempt to create or use an InnoDB FULLTEXT index on a column that has an incompatible internal index type. InnoDB FULLTEXT indexes have specific requirements for their underlying structure, and if a column or an existing index does not conform, this error is triggered. It commonly occurs during `CREATE TABLE` or `ALTER TABLE` operations when defining FULLTEXT indexes.
Error Message
Index '%s' is of wrong type for an InnoDB FULLTEXT index
Known Causes
3 known causesIncompatible Column Data Type
The column designated for the FULLTEXT index uses a data type (e.g., numeric, date, binary) that is not supported by InnoDB FULLTEXT indexing.
Existing Index Type Conflict
An index with the specified name already exists on the column but is not of the correct internal type required for an InnoDB FULLTEXT index.
Improper Table/Column Definition
The overall table or column definition, while syntactically correct for general indexing, does not meet the specific internal requirements for an InnoDB FULLTEXT index.
Solutions
3 solutions available1. Recreate the FULLTEXT Index with Correct Type easy
Drop and recreate the problematic FULLTEXT index to ensure it's of the correct type for InnoDB.
1
Identify the table and index name causing the error. The error message should provide this information. Let's assume the table is `my_table` and the index is `ft_index`.
2
Drop the existing FULLTEXT index.
ALTER TABLE my_table DROP INDEX ft_index;
3
Recreate the FULLTEXT index. Ensure the column(s) you are indexing are of a compatible type (like CHAR, VARCHAR, TEXT, MEDIUMTEXT, LONGTEXT).
ALTER TABLE my_table ADD FULLTEXT INDEX ft_index (column1, column2);
2. Verify and Correct Column Data Types for FULLTEXT Index medium
Ensure that the columns intended for a FULLTEXT index have appropriate data types.
1
Examine the schema of the table involved in the FULLTEXT index. Identify the columns that are part of the index.
SHOW CREATE TABLE my_table;
2
Check the data types of these columns. For InnoDB FULLTEXT indexes, compatible types include CHAR, VARCHAR, TEXT, MEDIUMTEXT, and LONGTEXT.
3
If any column has an incompatible data type (e.g., INT, DATE, BLOB), you will need to either change its type or exclude it from the FULLTEXT index. Changing the type might require data conversion.
ALTER TABLE my_table MODIFY COLUMN incompatible_column VARCHAR(255);
4
After correcting data types, if necessary, recreate the FULLTEXT index as described in Solution 1.
3. Convert Table to InnoDB and Recreate Index medium
If the table is not using the InnoDB storage engine, convert it and then recreate the FULLTEXT index.
1
Check the storage engine of the table.
SHOW TABLE STATUS LIKE 'my_table';
2
If the storage engine is not InnoDB, convert the table. This might take time for large tables.
ALTER TABLE my_table ENGINE=InnoDB;
3
Once the table is converted to InnoDB, recreate the FULLTEXT index to ensure it's correctly associated with the InnoDB engine.
ALTER TABLE my_table ADD FULLTEXT INDEX ft_index (column1, column2);