You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: duplicate ENUM members are accepted (MySQL: ERROR 1291); SET duplicates report 20301 instead of 1291 #31893
ENUM 定义里同一个成员出现两次(ENUM('a','a')、默认 ci 排序规则下的 ENUM('a','b','A')、尾部空格不同的 ENUM('a ','a'))时,MO 照样建表成功。后面的重复成员永远取不到(赋值总会落到第一个成员上)。MySQL 在严格模式下报 ERROR 1291 (HY000): Column 'e' has duplicated value 'a' in ENUM,非严格模式下给出 Note 1291。SET 的重复成员 MO 已经会拒绝,但报的是 20301 invalid input: duplicate set member "a",不是 1291。
环境
分支:main(a5485098,2026-10-30)
对照:MySQL 8.4.9(默认 sql_mode,含 STRICT_TRANS_TABLES)
复现步骤
createtabled1(id int, e enum('a','a'));
createtabled2(id int, e enum('a','b','A'));
createtabled4(id int, e enum('a ','a'));
createtabled3(id int, s set('a','a'));
createtabled5(id int, e enum('a','A') collate utf8mb4_bin);
实际结果(MO)
d1 / d2 / d4: Query OK
d3: ERROR 20301 (HY000): invalid input: duplicate set member "a"
d5: Query OK
期望结果(MySQL 8.4.9)
d1: ERROR 1291 (HY000): Column 'e' has duplicated value 'a' in ENUM
d2: ERROR 1291 (HY000): Column 'e' has duplicated value 'a' in ENUM
d4: ERROR 1291 (HY000): Column 'e' has duplicated value 'a' in ENUM
d3: ERROR 1291 (HY000): Column 's' has duplicated value 'a' in SET
d5: Query OK(binary 排序规则下大小写不同的成员不算重复)
Administratively consolidated into #31892. The reproduction and acceptance criteria remain tracked there. This does not claim that the defect is fixed or that every consolidated case has the same root cause. Assignee metadata is unchanged.
Activity
XuPeng-SH commentedon Nov 20, 2026
Administratively consolidated into #31892. The reproduction and acceptance criteria remain tracked there. This does not claim that the defect is fixed or that every consolidated case has the same root cause. Assignee metadata is unchanged.