Skip to content

doc: add note about table aliases in FOR UPDATE OF clause#22568

Open
cryo-zd wants to merge 1 commit intopingcap:masterfrom
cryo-zd:feat/forupdateof
Open

doc: add note about table aliases in FOR UPDATE OF clause#22568
cryo-zd wants to merge 1 commit intopingcap:masterfrom
cryo-zd:feat/forupdateof

Conversation

@cryo-zd
Copy link

@cryo-zd cryo-zd commented Mar 16, 2026

First-time contributors' checklist

What is changed, added or deleted? (Required)

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 16, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 16, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign lilin90 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Mar 16, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 16, 2026

Hi @cryo-zd. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Mar 16, 2026

Welcome @cryo-zd!

It looks like this is your first PR to pingcap/docs 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/docs. 😃

@ti-chi-bot ti-chi-bot bot added the missing-translation-status This PR does not have translation status info. label Mar 16, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the TiDB documentation for the SELECT statement by incorporating crucial information about the handling of table aliases in the FOR UPDATE OF clause. The update specifically addresses changes introduced in TiDB v8.5.6, providing users with clear guidance on alias usage, ensuring backward compatibility, and explaining how the system resolves potential ambiguities in complex queries involving identically named tables across different databases.

Highlights

  • Documentation Update for FOR UPDATE OF Clause: A new note has been added to the SELECT statement documentation, detailing the support for table aliases within the FOR UPDATE OF clause starting from TiDB v8.5.6. This note clarifies behavior regarding backward compatibility, warnings for using base table names when aliases are defined, and how ambiguity is resolved when multiple tables with the same name are involved.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • sql-statements/sql-statement-select.md
    • Added a detailed note explaining the new support for table aliases in the FOR UPDATE OF clause, effective from TiDB v8.5.6.
    • Included guidance on backward compatibility, the issuance of warnings when base table names are used with aliases, and the resolution mechanism for ambiguous table references.
Activity
  • The author confirmed completion of the Contributor License Agreement.
  • The changes are designated to be applied to the master, v9.0, and v8.5 branches of the documentation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@pingcap-cla-assistant
Copy link

pingcap-cla-assistant bot commented Mar 16, 2026

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 16, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a helpful note about the new support for table aliases in the FOR UPDATE OF clause. My review includes a suggestion to refine the wording for better clarity and consistency with the documentation style guide, particularly regarding the use of active voice and addressing the user directly.


> **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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low

To improve clarity and align with the style guide, I suggest a few wording improvements. This makes the text more direct and easier for users to understand.

Specifically, this suggestion:

  • Rewords advising you to use for better conciseness (Style Guide line 24).
  • Changes the passive it is recommended to specify to it is recommended that you specify, which is more consistent with the style guide's preference for using the second person ("you") and avoiding passive voice (Style Guide lines 22, 43).
Suggested change
> 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.
References
  1. The documentation should be written in the second person ('you') when addressing users. (link)
  2. The documentation should avoid unnecessary words and repetition for conciseness. (link)
  3. The documentation should avoid overuse of passive voice. (link)

@cryo-zd cryo-zd marked this pull request as ready for review March 17, 2026 07:49
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 17, 2026
@lilin90 lilin90 self-assigned this Mar 18, 2026
@lilin90 lilin90 added the translation/doing This PR's assignee is translating this PR. label Mar 18, 2026
@ti-chi-bot ti-chi-bot bot removed the missing-translation-status This PR does not have translation status info. label Mar 18, 2026
@lilin90 lilin90 requested a review from bb7133 March 18, 2026 08:40
@lilin90 lilin90 added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. translation/doing This PR's assignee is translating this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants