Skip to content

[Bug]: information_schema.check_constraints does not exist — breaks Prisma db pull / db push / migrate dev (v3.0.11 & 4.0-dev) #24730

Closed

Description

@dengn

Summary

information_schema.check_constraints does not exist. All other relevant IS views are present and queryable (tables, columns, statistics, key_column_usage, referential_constraints, table_constraints, views) — only check_constraints is missing. Prisma's MySQL schema connector queries it unconditionally in its describe_schema step, so every introspection-based command fails.

Steps to Reproduce

SELECT * FROM information_schema.check_constraints LIMIT 1;
-- ERROR 1064 (HY000): SQL parser error: table "check_constraints" does not exist

Prisma impact

prisma db pull, prisma db push, and prisma migrate dev all fail at the same place:

Error: SQL parser error: table "check_constraints" does not exist
   0: sql_schema_connector::flavour::mysql::connection::describe_schema
            at .../flavour/mysql/connection.rs:34

Only prisma migrate deploy (applies pre-generated SQL, no introspection) works. Authoring new migrations requires the offline workaround prisma migrate diff --from-empty --to-schema-datamodel ./schema.prisma --script.

Expected Behavior

MySQL 8 exposes information_schema.check_constraints (per SQL standard / MySQL 8.0.16+), even if empty. Providing an empty-but-present view would unblock Prisma introspection and other schema tools (Atlas, etc.).


Test context — Found while testing Prisma ORM (v5.22) compatibility against MatrixOne. Reproduced on both:

  • Prod cloud — 8.0.30-MatrixOne-v3.0.11
  • 4.0 dev line — nightly-0bfda604 (select version() → 8.0.30-MatrixOne-v)

(Results on the older v3.0.5 are intentionally omitted.)

Activity

  1. added
    kind/bug
    on May 31, 2026
  2. added
    severity/s0
    on Jun 2, 2026
  3. added theissue type on Jun 2, 2026
  4. added this to the MO-202606 milestone on Jun 2, 2026
  5. added
    severity/s1
    and removed
    severity/s0
    on Jun 30, 2026
  6. modified the milestones: MO-202606, MO-202607 on Jun 30, 2026
  7. added
    ai-light
    on Jul 1, 2026
  8. added
    ai-medium
    and removed
    ai-light
    on Jul 3, 2026
  9. removed
    severity/s1
    on Aug 6, 2026
  10. Ariznawlll commented on Aug 14, 2026

    @Ariznawlll
    Collaborator

    测试版本

    • 分支:main
    • commit:de40fe49fd105bd4d77bde8989369cec1fe65c76
    • 部署方式:本地隔离部署,2 CN / 1 TN / 1 Log,直连 CN
    • 测试日期:2026-08-14

    原问题验证

    information_schema.check_constraints 已存在且可查询:无 CHECK 的测试 schema 返回 0 行;创建两个命名 CHECK 后,能够准确返回 constraint_catalog/schema/name/check_clause,不再出现 table does not exist。完整矩阵及 MOTR 定向回归连续执行 3 轮均通过。

    Happy Path 覆盖

    1. 空 schema 查询正常返回 0,不要求必须存在约束数据。
    2. 两个命名 CHECK 与 information_schema.table_constraints 交叉核对,名称、类型及 clause 均准确。
    3. 返回列覆盖 Prisma introspection 所依赖的 CHECK 元数据表面。

    Unhappy Path 覆盖

    1. 违反 value >= 0 的 INSERT 返回 3819,未插入部分数据。
    2. 违反 value < 100 的 UPDATE 返回 3819,原行仍为 (1,10),(2,99)。
    3. 两次拒绝后 CHECK 元数据仍为 2 行,同一会话继续可用。

    白盒验证

    exact main 上 planner 与 mo_check_constraints table-function 的定向 UT 连续 3 轮通过,覆盖协议门控、列裁剪、空约束、解码、LIMIT 和错误恢复;本轮关闭依据为正式 public SQL 元数据接口的黑盒结果,不涉及并发共享状态,因此不单独增加 race gate。

    回归测试

    已加入 MOTR PR #109:issue_24730_check_constraints_metadata.test。定向 --repeat 3 为 3/3 通过;完整 14_issue_regression 中本用例通过。元数据存在性和约束原子性均可用小数据确定性覆盖,不需要大数据量回归。

    测试证据

    测试结论

    测试通过。

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

Metadata

Metadata

Assignees

Labels

ai-mediumkind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions