From b2b35e089019bff8f9941fae7dfbd5d6055d6633 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 7 May 2026 09:24:08 +0000 Subject: [PATCH 1/5] Auto-sync: Update English docs from Chinese PR Synced from: https://github.com/pingcap/docs-cn/pull/21600 Target PR: https://github.com/pingcap/docs/pull/22859 AI Provider: azure Co-authored-by: github-actions[bot] --- system-variables.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/system-variables.md b/system-variables.md index af52f91eec099..9a941010039bb 100644 --- a/system-variables.md +++ b/system-variables.md @@ -2857,6 +2857,26 @@ Assume that you have a cluster with 4 TiDB nodes and multiple TiKV nodes. In thi - Default value: `ON` - This variable is used to control whether to enable the statement summary feature. If enabled, SQL execution information like time consumption is recorded to the `information_schema.STATEMENTS_SUMMARY` system table to identify and troubleshoot SQL performance issues. +### `tidb_enable_strict_not_null_check` New in v9.0.0 + +- Scope: SESSION | GLOBAL +- Persists to cluster: Yes +- Can be set by Hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No +- Type: Boolean +- Default value: `ON` +- This variable controls whether TiDB performs strict validation when `NULL` values are explicitly written to `NOT NULL` columns in `INSERT` statements. +- Possible values: + - `ON`: Enables strict `NOT NULL` validation. This behavior is closer to the standard semantics of MySQL 8.0. + - In strict SQL mode, if a `NULL` value is inserted into a `NOT NULL` column, TiDB returns an error. + - In non-strict SQL mode: for single-row `INSERT` statements, if a `NULL` value is inserted into a `NOT NULL` column, TiDB returns an error; for multi-row `INSERT` statements, if a `NULL` value is inserted into a `NOT NULL` column, TiDB downgrades the error to a warning and writes the implicit default value corresponding to the column data type. + - `OFF`: Disables strict `NOT NULL` validation for compatibility with the more permissive behavior in earlier TiDB versions. When disabled, if a `NULL` value is inserted into a `NOT NULL` column, TiDB downgrades the error to a warning and writes the implicit default value corresponding to the column data type. For example, `0` is written for numeric types, and an empty string `''` is written for string types. + +> **Note:** +> +> - Earlier TiDB versions were relatively permissive in validating `NOT NULL` constraints. When a `NULL` value was inserted into a `NOT NULL` column, TiDB might automatically write the implicit default value corresponding to the column data type. Starting from v8.5.0, TiDB tightened this validation: even in non-strict SQL mode, inserting a `NULL` value into a `NOT NULL` column might directly return an error. This behavior is closer to MySQL 8.0 semantics, but it might affect existing applications that depend on the earlier permissive behavior of TiDB. +> +> - If you upgrade from an earlier TiDB version to a version with strict `NOT NULL` validation enabled, and your existing business logic depends on the behavior of automatically using implicit default values after writing `NULL` to `NOT NULL` columns, related SQL statements might return errors after the upgrade. If you cannot immediately modify the business logic, you can temporarily set this variable to `OFF` to reduce upgrade compatibility risks. It is recommended to later modify the application logic to avoid explicitly writing `NULL` values to `NOT NULL` columns. + ### tidb_enable_strict_double_type_check New in v5.0 - Scope: SESSION | GLOBAL From a5905da5c82278e11cffbe17a0a216fd2c17a217 Mon Sep 17 00:00:00 2001 From: qiancai Date: Thu, 7 May 2026 17:32:16 +0800 Subject: [PATCH 2/5] Update terms.md --- resources/terms.md | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/terms.md b/resources/terms.md index c02be92de796c..6691943e44721 100644 --- a/resources/terms.md +++ b/resources/terms.md @@ -16,6 +16,7 @@ | algorithm | 算法 | | | anonymous | 匿名 | | | appendix | 附录 | | +| Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value) | 是否受 Hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value) 控制: | | | architecture | 架构 | | | arithmetic operation | 数值运算/算术运算 | | | ascending order | 正序 | | From f09157ab1e915049c0c5bca5cc4e9ced0c976ea6 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Thu, 7 May 2026 17:50:45 +0800 Subject: [PATCH 3/5] Apply suggestions from code review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- system-variables.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/system-variables.md b/system-variables.md index 9a941010039bb..5a015f7bc7c6c 100644 --- a/system-variables.md +++ b/system-variables.md @@ -2861,21 +2861,21 @@ Assume that you have a cluster with 4 TiDB nodes and multiple TiKV nodes. In thi - Scope: SESSION | GLOBAL - Persists to cluster: Yes -- Can be set by Hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No - Type: Boolean - Default value: `ON` - This variable controls whether TiDB performs strict validation when `NULL` values are explicitly written to `NOT NULL` columns in `INSERT` statements. - Possible values: - - `ON`: Enables strict `NOT NULL` validation. This behavior is closer to the standard semantics of MySQL 8.0. - - In strict SQL mode, if a `NULL` value is inserted into a `NOT NULL` column, TiDB returns an error. - - In non-strict SQL mode: for single-row `INSERT` statements, if a `NULL` value is inserted into a `NOT NULL` column, TiDB returns an error; for multi-row `INSERT` statements, if a `NULL` value is inserted into a `NOT NULL` column, TiDB downgrades the error to a warning and writes the implicit default value corresponding to the column data type. - - `OFF`: Disables strict `NOT NULL` validation for compatibility with the more permissive behavior in earlier TiDB versions. When disabled, if a `NULL` value is inserted into a `NOT NULL` column, TiDB downgrades the error to a warning and writes the implicit default value corresponding to the column data type. For example, `0` is written for numeric types, and an empty string `''` is written for string types. + - `ON`: Enables strict `NOT NULL` validation. This behavior is closer to MySQL 8.0 semantics. + - In strict SQL mode, if you insert a `NULL` value into a `NOT NULL` column, TiDB returns an error. + - In non-strict SQL mode: for a single-row `INSERT` statement, if you insert a `NULL` value into a `NOT NULL` column, TiDB returns an error; for a multi-row `INSERT` statement, if you insert a `NULL` value into a `NOT NULL` column, TiDB downgrades the error to a warning and writes the implicit default value of the column data type. + - `OFF`: Disables strict `NOT NULL` validation for compatibility with the permissive behavior in earlier TiDB versions. When disabled, if you insert a `NULL` value into a `NOT NULL` column, TiDB downgrades the error to a warning and writes the implicit default value for the column data type. For example, TiDB writes `0` for numeric types and an empty string `''` for string types. > **Note:** > -> - Earlier TiDB versions were relatively permissive in validating `NOT NULL` constraints. When a `NULL` value was inserted into a `NOT NULL` column, TiDB might automatically write the implicit default value corresponding to the column data type. Starting from v8.5.0, TiDB tightened this validation: even in non-strict SQL mode, inserting a `NULL` value into a `NOT NULL` column might directly return an error. This behavior is closer to MySQL 8.0 semantics, but it might affect existing applications that depend on the earlier permissive behavior of TiDB. +> - Earlier TiDB versions were permissive in validating `NOT NULL` constraints. When you insert a `NULL` value into a `NOT NULL` column, TiDB automatically writes the implicit default value of the column data type. Starting from v8.5.0, TiDB tightened this validation: even in non-strict SQL mode, inserting a `NULL` value into a `NOT NULL` column might return an error. This behavior is closer to MySQL 8.0 semantics but might affect applications that depend on the earlier permissive behavior. > -> - If you upgrade from an earlier TiDB version to a version with strict `NOT NULL` validation enabled, and your existing business logic depends on the behavior of automatically using implicit default values after writing `NULL` to `NOT NULL` columns, related SQL statements might return errors after the upgrade. If you cannot immediately modify the business logic, you can temporarily set this variable to `OFF` to reduce upgrade compatibility risks. It is recommended to later modify the application logic to avoid explicitly writing `NULL` values to `NOT NULL` columns. +> - If you upgrade from an earlier TiDB version to a version where strict `NOT NULL` validation is enabled, and your existing application logic depends on the behavior of automatically using implicit default values after writing `NULL` to `NOT NULL` columns, related SQL statements might return errors after the upgrade. If you cannot immediately modify the business logic, you can temporarily set this variable to `OFF` to reduce upgrade compatibility risks. It is recommended that you later update the application logic to avoid explicitly writing `NULL` values to `NOT NULL` columns. ### tidb_enable_strict_double_type_check New in v5.0 From 06dca9d9007af7563883ee8770bd146ff85dc4d0 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Thu, 7 May 2026 17:51:23 +0800 Subject: [PATCH 4/5] Update resources/terms.md --- resources/terms.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/terms.md b/resources/terms.md index 6691943e44721..40573bf82de9d 100644 --- a/resources/terms.md +++ b/resources/terms.md @@ -16,7 +16,7 @@ | algorithm | 算法 | | | anonymous | 匿名 | | | appendix | 附录 | | -| Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value) | 是否受 Hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value) 控制: | | +| Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): | 是否受 Hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value) 控制: | | | architecture | 架构 | | | arithmetic operation | 数值运算/算术运算 | | | ascending order | 正序 | | From 9461b6c2404d1fe80a4fed82937cfef325ea80c4 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Thu, 7 May 2026 17:54:29 +0800 Subject: [PATCH 5/5] Update system-variables.md --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 5a015f7bc7c6c..3644b5955fbf9 100644 --- a/system-variables.md +++ b/system-variables.md @@ -2864,7 +2864,7 @@ Assume that you have a cluster with 4 TiDB nodes and multiple TiKV nodes. In thi - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No - Type: Boolean - Default value: `ON` -- This variable controls whether TiDB performs strict validation when `NULL` values are explicitly written to `NOT NULL` columns in `INSERT` statements. +- This variable controls whether TiDB performs strict validation when an `INSERT` statement explicitly writes a `NULL` value to a `NOT NULL` column. - Possible values: - `ON`: Enables strict `NOT NULL` validation. This behavior is closer to MySQL 8.0 semantics. - In strict SQL mode, if you insert a `NULL` value into a `NOT NULL` column, TiDB returns an error.