Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: Field ‘id’ doesn’t have a default value?

[Test Environment] TiDB
[TiDB Version] 7.1
[Reproduction Path] Operations performed that led to the issue
[Encountered Issue: Phenomenon and Impact]
The original MySQL used auto-increment IDs, causing storage hotspots. Now SHARD_ROW_ID_BITS is needed, but the following syntax results in an error. Please help check, thank you.
drop table test
[2023-07-10 16:15:00] completed in 526 ms
mysql> CREATE TABLE test
(
id
BIGINT PRIMARY KEY NONCLUSTERED,
name
varchar(1000)
) SHARD_ROW_ID_BITS = 4 CHARACTER SET=utf8mb4 COLLATE utf8mb4_general_ci
[2023-07-10 16:15:01] completed in 529 ms
mysql> insert into test(name) values (‘safasf’)
[2023-07-10 16:15:01] [HY000][1364] Field ‘id’ doesn’t have a default value
[2023-07-10 16:15:01] [HY000][1364] Field ‘id’ doesn’t have a default value
[Resource Configuration]
SHARD_ROW_ID_BITS
[Attachments: Screenshots/Logs/Monitoring]