How to Determine if the Primary Key of a Table in TiDB is Auto_random

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 如何得知TIDB 一个表中的主键 是否为Auto_random

| username: TiDBer_RDDvKTSa

[TiDB Usage Environment] Development Environment
[TiDB Version] 5.1.5 Edition

Currently, when using TiDB, the Auto Increment column will have “auto_increment” in the extra field of information_schema.columns. However, if auto_random is set, the extra field content is empty. Although it is possible to check information_schema.tables and determine whether the table has an autoRandom primary key through its TIDB_ROW_ID_SHARDING_INFO field, and thus determine whether the field is auto_random, it still feels somewhat cumbersome. Is there a better way to determine whether a field is auto_random, or can support for displaying auto_random in the extra field of COLUMNS be added in the future?

| username: Billmay表妹 | Original post link

You can check if this article is helpful to you.