Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb auto_random和ttl设置优化
After executing the statement following “show create table” to create a new table in TiDB, both auto_random and ttl did not take effect.
Please post the reproduction steps. There’s only one sentence, and it’s unclear what it is.
Neither TTL nor auto_rand took effect when creating the new table.
Cousin, did I make myself clear?
Show the table structure.
When executing the command line, add -c to log in, otherwise the /**/ will be treated as a comment.
As mentioned above, the MySQL client needs to log in with the -c
option so that comments are sent to the server, or you can simply avoid writing comments.
–comments Whether to strip or retain comments in the statements sent to the server. The default value is --skip-comments.
Thank you all, I already have the answer. Thank you very much.
TiDB executable comment syntax. It is mainly divided into two types:
/*T! Specific code */
: This syntax can only be parsed and executed by TiDB, while it will be ignored in other databases.
/*T![feature_id] Specific code */
: This syntax is used to ensure compatibility between different versions of TiDB. Only the TiDB version that has implemented the feature corresponding to feature_id
will attempt to parse the SQL fragment within the comment. For example, the AUTO_RANDOM
feature was introduced in v3.1.1, and this version can parse /*T![auto_rand] auto_random */
as auto_random
; whereas in v3.0.0, which does not have the AUTO_RANDOM
feature, the above SQL fragment will be ignored. Note that there are no spaces between the characters in /*T![
.
Comment Syntax | PingCAP Documentation Center
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.