Skip to content

need to clarify the example in AUTO_RANDOM #20732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hfxsd opened this issue Apr 10, 2025 · 2 comments · May be fixed by #20734
Open

need to clarify the example in AUTO_RANDOM #20732

hfxsd opened this issue Apr 10, 2025 · 2 comments · May be fixed by #20734
Assignees

Comments

@hfxsd
Copy link
Collaborator

hfxsd commented Apr 10, 2025

Error Report

Feedback in Chinese:

https://docs.pingcap.com/tidb/stable/auto-random/#user-scenario 文档中的代码示例存在误导,执行ALTER TABLE t AUTO_RANDOM_BASE=0;后确实会输出Can't reset AUTO_INCREMENT to 0 without FORCE option, using xxxx instead,但这并没有起效。需要使用force关键字执行设置,但直觉会让我参考ALTER TABLE t AUTO_RANDOM_BASE=0;就会去执行ALTER TABLE t force AUTO_RANDOM_BASE=0;又会报错不能将下一个ID设置为0。探索后发现需要设置成非0数字。

English translation:

In this doc, https://docs.pingcap.com/tidb/stable/auto-random/#user-scenario, the code example is misleading. After executing ALTER TABLE t AUTO_RANDOM_BASE=0;, it does output Can't reset AUTO_INCREMENT to 0 without FORCE option, using xxxx instead, but the setting does not actually take effect. You need to use the FORCE keyword to apply the change. However, intuitively, referencing ALTER TABLE t AUTO_RANDOM_BASE=0; might lead one to try ALTER TABLE t FORCE AUTO_RANDOM_BASE=0;, which results in an error saying that the next ID cannot be set to 0. After some exploration, I found that it must be set to a non-zero number.

We need to clarify that in the doc.

@hfxsd
Copy link
Collaborator Author

hfxsd commented Apr 10, 2025

@OliverS929 @alastori @tangenta PTAL, thanks~

@alastori
Copy link
Contributor

Please review: #20734
cc @Frank945946

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants