Skip to content

[Compatibility]: SERIAL type alias is rejected by the parser #31748

Closed

Description

@Ariznawlll

Description

MySQL type-alias census on main c6683bd2f5 (2026-10-29) — three standard MySQL type spellings are rejected by the parser while their canonical forms all work, blocking otherwise-valid MySQL DDL:

alias accepted canonical MO MySQL 8.0
SERIAL BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE 1064 alias since antiquity; ORM/legacy dumps emit it routinely
BIGSERIAL (Postgres-ism also in MySQL for compatibility in some tools' DDL; strictly PG) — 1064 (n/a in MySQL-core, listed here as census context)
TIME(8) TIME(6) works, fractional scale > 6 1064 MySQL rejects scales >6 too — verified consistent, not a defect — (kept in table only to record the census cutoff)

Also verified working in the same census (all OK): MEDIUMINT, YEAR, SET, MEDIUMTEXT/LONGTEXT/TINYTEXT, REAL, DOUBLE PRECISION. The gaps are strictly SERIAL and (for the national-character family, tracked separately in #24490) NCHAR/NATIONAL VARCHAR.

Focused report:

CREATE TABLE t (id SERIAL);
-- ERROR 1064 ... near " SERIAL"
-- MySQL: accepted; expands to BIGINT UNSIGNED AUTO_INCREMENT UNIQUE NOT NULL

SERIAL is common in PHPCrud/legacy migrations and in pg_translation tools; receiving a 1064 on it makes MO DDL-direct-import paths fail on a one-word alias that has a pure grammatical expansion.

Impact

  • MySQL-schema importers (mysqldump files, Laravel/Rails migrations authored against MySQL) fail on tables whose id column was written as SERIAL.
  • The expansion is purely syntactic — no new storage semantics involved (MO's BIGINT UNSIGNED AUTO_INCREMENT UNIQUE already works, verified) — so this is a grammar-only gap.

Expected behavior

Parse SERIAL and expand to the canonical form at DDL translation; the components already all work. (Whether also to accept Postgres-style BIGSERIAL/SMALLSERIAL is a product decision; none of them exist in MySQL, so the minimum ask is SERIAL only.)

Reproduction

CREATE TABLE t (id SERIAL); — single line. Census of surrounding type spellings ran clean (13-item table above), main @ c6683bd.

Activity

  1. added
    kind/bug
    on Oct 29, 2026
  2. added this to the MO-202610 milestone on Oct 29, 2026
  3. added theissue type on Oct 29, 2026
  4. assigned and unassigned on Nov 4, 2026
  5. added a commit that references this issue on Nov 5, 2026
    80224b0
  6. XuPeng-SH commented on Nov 5, 2026

    @XuPeng-SH
    Contributor

    QA 交接:SERIAL 列类型现展开为 BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE,覆盖 CREATE TABLE 和 ALTER TABLE ADD COLUMN;保留 SERIAL 非保留标识符、既有 serial(...) 函数调用及嵌套 AST,CAST/CONVERT/序列类型的原边界不扩大。

    PR #32196 已于 2026-11-05 02:03:08 UTC 合入 main,merge SHA 80224b0314c6008ecb4de82d1e37b019d5e355df,最终 head 5cfcb401ac173cbe1380abdf2b83b2afb51c53b5。完整 issue 和 PR 讨论未见当前适用的已验证反例或未完成开发 follow-up,可交 QA。

    验证证据与限制:

    • 审查针对 4311fe84d50a509b1b202e0eebf530289c4202b6:规范生成结果字节一致,既有 796 个 token 常量和 2,049 个 action body 保留;两个 parser 包及新增 16 个顶层测试通过。复审未新跑在线 SQL/BVT 或 planner/explain。
    • 作者报告较早 ab5 基础的匹配源码 CGO 构建通过 SERIAL 28/28、bare grants 56/56,以及 grant_privs_role 226/226;相关语法、真实 DDL/catalog、授权拒绝和清理结果保留其原版本身份。作者详细原始日志未提供,不能改称最终 head 服务实测。
    • 最终 head 相比已审查版本,11 个交付文件均未变化,最终 head 与合并提交的完整代码树一致。最终 CI Required 失败原因为 matrixone-ci: cancelled,共享构建通过;清理任务明确在合并后请求取消该运行。未完成的 UT/SCA/BVT 不宣称通过,也没有据此确认产品缺陷。较早审查版本 CI 的通过保留旧 head 身份。
    • 本轮没有本地重跑产品测试;交接不代表验收通过,也不代表多 CN 或部署验证完成。

    建议 QA 对原始 CREATE TABLE(id SERIAL) 与标准展开写法核对 SHOW CREATE/catalog、自动增长、无符号范围、NOT NULL/UNIQUE、重复值拒绝及 ALTER ADD;回归 serial 标识符/函数、serial_extract 嵌套与复合索引生成表达式。原 issue 已说明 BIGSERIAL/SMALLSERIAL 非 MySQL 最小诉求,TIME(8) 拒绝与 MySQL 一致,不把它们当成本单未完成项。

    交由 @Ariznawlll 继续验证。

  7. slyunnn commented on Nov 9, 2026

    @slyunnn

    Regression and extended verification for #31748 (2026-11-09)

    Verification Environment

    • MatrixOne main: c99234dcf4c94d1ff9d372917cd35041f1a3a682 — refactor: integrate temporal index planning with shared owners (#32341); freshly built runtime reported git_version() = c99234d.
    • Local topology: 2 CN / 1 TN / 1 LogService / Proxy. Proxy 26833, CN1 27151, and CN2 27152 were reachable over the MySQL TCP protocol. Original DDL and write tests ran through Proxy; table reads and serial/serial_extract controls also ran directly on both CNs.
    • MySQL 8.0.46 in an isolated local instance supplied the comparison.

    What Was Covered

    • OK Original CREATE TABLE t (id SERIAL) succeeded. SHOW CREATE TABLE and catalog metadata showed BIGINT UNSIGNED NOT NULL AUTO_INCREMENT and a unique key, matching the expected expansion.
    • OK Two NULL inserts generated IDs 1 and 2; the canonical explicit type and ALTER TABLE ... ADD COLUMN id SERIAL controls produced the same values.
    • OK Duplicate ID was rejected with ERROR 1062; a negative unsigned value and an update to NULL were rejected on both servers. Their error codes differ as noted below.
    • OK 18446744073709551615 was stored successfully. A table and column named serial remained usable as identifiers.
    • OK Existing serial and nested serial_extract calls returned 42 and abc through all three endpoints.
    • OK TIME(8) was rejected on both servers; the reported BIGSERIAL census item is outside the issue's MySQL SERIAL minimum scope.
    • Not covered Full distributed BVT, binary prepared DDL, composite-index expression regression, or an asserted parallel/multi-CN execution plan.

    Findings

    The reported SERIAL type-alias failure is fixed for the tested DDL paths. The merged fix is PR #32196, commit 80224b0314c6008ecb4de82d1e37b019d5e355df.

    The rejection outcomes agree but diagnostics differ: negative unsigned insertion returned MatrixOne 1690 versus MySQL 1264; updating the column to NULL returned MatrixOne 3819 versus MySQL 1048. These are diagnostic differences, not failures to enforce the tested constraints.

    MOTR / BVT Coverage

    No MOTR case was added: the merged source contains test/distributed/cases/auto_increment/serial_alias.sql. This run executed direct SQL; the full BVT suite was not rerun and no engine-parallel or MOTR parallel execution is claimed.

    Final Conclusion

    Fixed for the reported SERIAL alias and the tested expansion/constraint behavior on the pinned main. Large-data regression is not needed for the parser alias and column-constraint semantics; increasing row count alone would not exercise a relevant boundary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions