From dd8d924140ccead14a75e1bf06cf7de3722f3c9f Mon Sep 17 00:00:00 2001 From: cryo Date: Wed, 11 Mar 2026 17:18:23 +0800 Subject: [PATCH 1/3] doc: add note about table aliases in FOR UPDATE OF clause --- sql-statements/sql-statement-select.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql-statements/sql-statement-select.md b/sql-statements/sql-statement-select.md index 70d06730753e5..2391e744da6a1 100644 --- a/sql-statements/sql-statement-select.md +++ b/sql-statements/sql-statement-select.md @@ -108,6 +108,10 @@ TableSample ::= > > Starting from v6.6.0, TiDB supports [Resource Control](/tidb-resource-control-ru-groups.md). You can use this feature to execute SQL statements with different priorities in different resource groups. By configuring proper quotas and priorities for these resource groups, you can gain better scheduling control for SQL statements with different priorities. When resource control is enabled, statement priority (`HIGH_PRIORITY`) will no longer take effect. It is recommended that you use [Resource Control](/tidb-resource-control-ru-groups.md) to manage resource usage for different SQL statements. +> **Note:** +> +> Starting from v8.5.6, TiDB supports using table aliases in the `FOR UPDATE OF` clause. To maintain backward compatibility, referencing the base table name when an alias is defined is still allowed, but it will trigger a warning advising you to use the explicit alias. When a query involves multiple tables with the same name across different databases (for example, `FROM db1.t, db2.t FOR UPDATE OF t`), TiDB now matches the target table from left to right based on the order in the `FROM` clause, rather than the current database context. To avoid ambiguity, it is recommended to specify the database name or use aliases in the `FOR UPDATE OF` clause. + ## Examples ### SELECT From a4ee3a755e6e6be7137c86cb6ee589a3b0c705d5 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Tue, 31 Mar 2026 16:15:03 +0800 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- sql-statements/sql-statement-select.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-select.md b/sql-statements/sql-statement-select.md index 2391e744da6a1..7f6b4782d948d 100644 --- a/sql-statements/sql-statement-select.md +++ b/sql-statements/sql-statement-select.md @@ -110,7 +110,7 @@ TableSample ::= > **Note:** > -> Starting from v8.5.6, TiDB supports using table aliases in the `FOR UPDATE OF` clause. To maintain backward compatibility, referencing the base table name when an alias is defined is still allowed, but it will trigger a warning advising you to use the explicit alias. When a query involves multiple tables with the same name across different databases (for example, `FROM db1.t, db2.t FOR UPDATE OF t`), TiDB now matches the target table from left to right based on the order in the `FROM` clause, rather than the current database context. To avoid ambiguity, it is recommended to specify the database name or use aliases in the `FOR UPDATE OF` clause. +> Starting from v8.5.6, TiDB supports using table aliases in the `FOR UPDATE OF` clause. To maintain backward compatibility, you can still reference the base table name when an alias is defined, but this triggers a warning that recommends using the explicit alias. When a query involves multiple tables with the same name across different databases (for example, `FROM db1.t, db2.t FOR UPDATE OF t`), TiDB now matches the target table from left to right based on the order in the `FROM` clause, rather than the current database context. To avoid ambiguity, it is recommended that you specify the database name or use aliases in the `FOR UPDATE OF` clause. ## Examples From 10bc7864e11c76e5a1447341f6e224888ffff0ca Mon Sep 17 00:00:00 2001 From: lilin90 Date: Tue, 31 Mar 2026 16:17:22 +0800 Subject: [PATCH 3/3] Update note --- sql-statements/sql-statement-select.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sql-statements/sql-statement-select.md b/sql-statements/sql-statement-select.md index 7f6b4782d948d..d683c76dfd155 100644 --- a/sql-statements/sql-statement-select.md +++ b/sql-statements/sql-statement-select.md @@ -106,11 +106,8 @@ TableSample ::= > **Note:** > -> Starting from v6.6.0, TiDB supports [Resource Control](/tidb-resource-control-ru-groups.md). You can use this feature to execute SQL statements with different priorities in different resource groups. By configuring proper quotas and priorities for these resource groups, you can gain better scheduling control for SQL statements with different priorities. When resource control is enabled, statement priority (`HIGH_PRIORITY`) will no longer take effect. It is recommended that you use [Resource Control](/tidb-resource-control-ru-groups.md) to manage resource usage for different SQL statements. - -> **Note:** -> -> Starting from v8.5.6, TiDB supports using table aliases in the `FOR UPDATE OF` clause. To maintain backward compatibility, you can still reference the base table name when an alias is defined, but this triggers a warning that recommends using the explicit alias. When a query involves multiple tables with the same name across different databases (for example, `FROM db1.t, db2.t FOR UPDATE OF t`), TiDB now matches the target table from left to right based on the order in the `FROM` clause, rather than the current database context. To avoid ambiguity, it is recommended that you specify the database name or use aliases in the `FOR UPDATE OF` clause. +> - Starting from v8.5.6, TiDB supports using table aliases in the `FOR UPDATE OF` clause. To maintain backward compatibility, you can still reference the base table name when an alias is defined, but this triggers a warning that recommends using the explicit alias. When a query involves multiple tables with the same name across different databases (for example, `FROM db1.t, db2.t FOR UPDATE OF t`), TiDB now matches the target table from left to right based on the order in the `FROM` clause, rather than the current database context. To avoid ambiguity, it is recommended that you specify the database name or use aliases in the `FOR UPDATE OF` clause. +> - Starting from v6.6.0, TiDB supports [Resource Control](/tidb-resource-control-ru-groups.md). You can use this feature to execute SQL statements with different priorities in different resource groups. By configuring proper quotas and priorities for these resource groups, you can gain better scheduling control for SQL statements with different priorities. When resource control is enabled, statement priority (`HIGH_PRIORITY`) will no longer take effect. It is recommended that you use [Resource Control](/tidb-resource-control-ru-groups.md) to manage resource usage for different SQL statements. ## Examples