CREATE MATERIALIZED VIEW accepts COMMENT strings longer than 128 characters
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
Reproduced on March 8, 2026 in a temporary TiDB testbed.
```sql
DROP DATABASE IF EXISTS mv_comment_len;
CREATE DATABASE mv_comment_len;
USE mv_comment_len;
CREATE TABLE t (
id BIGINT NOT NULL PRIMARY KEY,
g1 INT NOT NULL,
v1 BIGINT NOT NULL,
KEY idx_g1 (g1)
);
CREATE MATERIALIZED VIEW LOG ON t (id, g1, v1);
-- 129 characters
CREATE MATERIALIZED VIEW mv_c129 (g1, cnt)
COMMENT = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
REFRESH FAST
AS
SELECT g1, COUNT(*) AS cnt
FROM t
GROUP BY g1;
SHOW CREATE MATERIALIZED VIEW mv_c129;
```
### 2. What did you expect to see? (Required)
The MView `COMMENT` length should be limited to 128 characters. A 129-character comment should be rejected and the MView should not be created.
### 3. What did you see instead (Required)
The `CREATE MATERIALIZED VIEW` statement succeeded, and `SHOW CREATE MATERIALIZED VIEW mv_c129` also succeeded. The MView existed even though the comment exceeded the documented limit.
### 4. What is your TiDB version? (Required)
Exact `SELECT tidb_version()` output was not preserved before the temporary testbed was deleted.
This was reproduced on March 8, 2026 in a temporary TiDB testbed running a TiDB server image tagged `v8.5.4-9938`.
Contributor guide
Assessment
This issue has not been assessed yet.