Error
Error Code: 1121

MariaDB Error 1121: Invalid NULLable Index

📦 MariaDB
📋

Description

This error occurs when you attempt to create or modify an index on a table, and one of the columns included in that index is defined as NULLable. The specific table storage engine (handler) being used does not permit NULL values within the context of the defined index, typically for primary keys or unique indexes.
💬

Error Message

Table handler doesn't support NULL in given index. Please change column '%s' to be NOT NULL or use another handler
🔍

Known Causes

4 known causes
⚠️
Unique Index on NULLable Column
Attempting to define a UNIQUE index on a column that permits NULL values is often disallowed by storage engines, as NULL is treated inconsistently for uniqueness checks.
⚠️
Primary Key on NULLable Column
A PRIMARY KEY inherently requires all indexed columns to be NOT NULL. This error occurs if you try to define a primary key on a column allowing NULLs.
⚠️
Storage Engine Restriction
Some table handlers, like NDB Cluster or certain configurations of InnoDB, have stricter rules regarding NULL values in indexes beyond standard SQL specifications.
⚠️
Implicit Index Conflict
This error can occur if an operation, such as creating a FOREIGN KEY constraint, implicitly tries to create an index on a NULLable column where the underlying handler doesn't support it.
🛠️

Solutions

Coming Soon

Detailed step-by-step solutions for this error are being prepared. In the meantime, try these general troubleshooting tips:

General 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
🔗

Related Errors

5 related errors