Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql_mode 设置了HIGH_NOT_PRECEDENCE时,建表语句 not null 检测报错 #629

Open
mago-git opened this issue Dec 18, 2023 · 1 comment

Comments

@mago-git
Copy link

描述
当sql_mode 设置了HIGH_NOT_PRECEDENCE 时,如果列中有not null设置,会得到一个错误,并且没有足够明确的提示信息

重现
例如:
CREATE TABLE test (
id BIGINT(19) not null AUTO_INCREMENT COMMENT '主键',
user_task_id VARCHAR(200) not null COMMENT '用户任务Id' COLLATE 'utf8mb4_general_ci',
PRIMARY KEY (id) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=167
;
将会得到下面的提示信息,看起来像把此处的not当作了运算符??,我的理解这个参数应当只是在条件语句中调整运算符优先级
line 2 column 21 near "not null AUTO_INCREMENT COMMENT '主键', user_task_id VARCHAR(200) not null COMMENT '用户任务Id' COLLATE 'utf8mb4_general_ci', PRIMARY KEY (id) USING BTREE ) COLLATE='utf8mb4_general_ci' ENGINE=InnoDB AUTO_INCREMENT=167 "

环境

  • 数据库: [mysql]
  • 版本: [8.0.25]

参数
sql_mode: REAL_AS_FLOAT,PIPES_AS_CONCAT,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION

@zmix999
Copy link

zmix999 commented Feb 20, 2024

可以看下我fork的分支,修复了这个问题https://gitee.com/zhoujin826/goInception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants