Skip to content

[Bug]: ENUM column cannot be used in any secondary/unique/composite index (v3.0.11 & 4.0-dev) #24729

Closed

Description

@dengn

Summary

Creating any non-primary index that includes an ENUM column fails — secondary, unique, and composite (ENUM at any position) are all rejected. ENUM columns themselves, enum filters, and enum validation work fine; only indexing them fails.

Steps to Reproduce

CREATE TABLE t1 (id VARCHAR(191) PRIMARY KEY, role ENUM('a','b','c'), INDEX idx_role(role));
-- ERROR 20105 (HY000): not supported: ENUM column 'role' cannot be in secondary index

CREATE TABLE t2 (id VARCHAR(191) PRIMARY KEY, role ENUM('a','b','c'), UNIQUE INDEX uq_role(role));
-- ERROR 20105 (HY000): not supported: ENUM column 'role' cannot be in unique index

CREATE TABLE t3 (id VARCHAR(191) PRIMARY KEY, name VARCHAR(191), role ENUM('a','b','c'), INDEX idx(name, role));
-- ERROR 20105 (HY000): not supported: ENUM column 'role' cannot be in secondary index

Prisma impact

Any Prisma model with @@index/@@unique on an enum field fails to migrate. We had to remove 4 such indexes (e.g. users(workspace_id, role), branches(status)) from the schema + generated SQL.

Expected Behavior

MySQL allows ENUM columns in secondary and unique indexes.


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. assigned and unassigned on Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugseverity/s0

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions