InnoDB Strict Mode
InnoDB Strict Mode enforces stricter SQL compliance, returning errors instead of warnings for invalid CREATE TABLE options or potential data loss.
InnoDB strict mode is similar to SQL strict mode. When it is enabled, certain InnoDB warnings become errors instead.
Configuring InnoDB Strict Mode
InnoDB strict mode is enabled by default.
InnoDB strict mode can be enabled or disabled by configuring the innodb_strict_mode server system variable.
Its global value can be changed dynamically with SET GLOBAL:
SET GLOBAL innodb_strict_mode=ON;Its value for the current session can also be changed dynamically with SET SESSION:
SET SESSION innodb_strict_mode=ON;It can also be set in a server option group in an option file prior to starting up the server:
[mariadb]
...
innodb_strict_mode=ONInnoDB Strict Mode Errors
Wrong Create Options
If InnoDB strict mode is enabled, and if a DDL statement is executed and invalid or conflicting table options are specified, then an error is raised. The error will only be a generic error that says the following:
However, more details about the error can be found by executing SHOW WARNINGS.
For example, the error is raised in the following cases:
The KEY_BLOCK_SIZE table option is set to a non-zero value, but the ROW_FORMAT table option is set to some row format other than the COMPRESSED row format:
The KEY_BLOCK_SIZE table option is set to a non-zero value, but the configured value is larger than either
16or the value of the innodb_page_size system variable, whichever is smaller.
The KEY_BLOCK_SIZE table option is set to a non-zero value, but the innodb_file_per_table system variable is not set to
ON.
The KEY_BLOCK_SIZE table option is set to a non-zero value, but it is not set to one of the supported values: [1, 2, 4, 8, 16].
The ROW_FORMAT table option is set to the COMPRESSED row format, but the innodb_file_per_table system variable is not set to
ON.
The ROW_FORMAT table option is set to a value, but it is not set to one of the values supported by InnoDB: REDUNDANT, COMPACT, DYNAMIC, and COMPRESSED.
Either the KEY_BLOCK_SIZE table option is set to a non-zero value or the ROW_FORMAT table option is set to the COMPRESSED row format, but the innodb_page_size system variable is set to a value greater than
16k.
The DATA DIRECTORY table option is set, but the innodb_file_per_table system variable is not set to
ON.
The DATA DIRECTORY table option is set, but the table is a temporary table.
The INDEX DIRECTORY table option is set.
The PAGE_COMPRESSED table option is set to
1, so InnoDB page compression is enabled, but the ROW_FORMAT table option is set to some row format other than the COMPACT or DYNAMIC row formats.
The PAGE_COMPRESSED table option is set to
1, so InnoDB page compression is enabled, but the innodb_file_per_table system variable is not set toON.
The PAGE_COMPRESSED table option is set to
1, so InnoDB page compression is enabled, but the KEY_BLOCK_SIZE table option is also specified.
The PAGE_COMPRESSION_LEVEL table option is set, but the PAGE_COMPRESSED table option is set to
0, so InnoDB page compression is disabled.
COMPRESSED Row Format
If InnoDB strict mode is enabled, and if a table uses the COMPRESSED row format, and if the table's KEY_BLOCK_SIZE is too small to contain a row, then an error is returned by the statement.
Row Size Too Large
If InnoDB strict mode is enabled, and if a table exceeds its row format's maximum row size, then InnoDB will return an error.
See Troubleshooting Row Size Too Large Errors with InnoDB for more information.
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?

