hanchuanchuan / goInception

一个集审核、执行、备份及生成回滚语句于一身的MySQL运维工具
https://hanchuanchuan.github.io/goInception/
GNU General Public License v3.0
1.59k stars 545 forks source link

sql没加虚拟表from dual审核错误 #655

Open LiuHuAshen opened 4 weeks ago

LiuHuAshen commented 4 weeks ago

描述

INSERT INTO employees (id, first_name, last_name, salary) 
SELECT (select IFNULL(MAX(id), 0) from employees) + 1, 'John', 'Doe2', 50000.0 
WHERE NOT EXISTS (SELECT 1 FROM employees WHERE first_name='John3'); 

这个语句可以在navicate正常执行,但是 在archery,goinception审核不过,异常信息如下,

image

加上from dual后正常解析语句并审核了,这是为什么呢

INSERT INTO employees (id, first_name, last_name, salary) 
SELECT (select IFNULL(MAX(id), 0) from employees) + 1, 'John', 'Doe2', 50000.0 
from dual
WHERE NOT EXISTS (SELECT 1 FROM employees WHERE first_name='John3'); 
image

环境

zmix999 commented 4 weeks ago

应该是parser解析问题,也可以看下我的fork的分支https://gitee.com/zhoujin826/goInception image