Error
Error Code:
1687
MySQL Error 1687: Invalid Spatial Index Column Type
Description
MySQL Error 1687 indicates that you are attempting to create a SPATIAL index on a column that is not a geometric data type. SPATIAL indexes are specifically designed to optimize queries on spatial data types such as POINT, LINESTRING, and POLYGON. This error typically occurs during CREATE TABLE or ALTER TABLE statements when defining an index on a non-geometric column.
Error Message
A SPATIAL index may only contain a geometrical type column
Known Causes
3 known causesNon-Geometric Column Type
Attempting to define a SPATIAL index on a column that is not a geometric data type (e.g., INT, VARCHAR, DATETIME) instead of a recognized spatial type.
Incorrect Index Definition
Defining an index as SPATIAL without understanding its specific requirement for the indexed column to store geometric data.
Typographical Error in Schema
An accidental mistake or typo in the column's data type definition or the index type specification during table creation or modification.
Solutions
Coming SoonGeneral Troubleshooting Tips
- Check the error message carefully for specific details
- Review recent changes that might have caused the error
- Search for the exact error code in the official documentation
- Check log files for additional context
- Try restarting the application or service