hanchuanchuan / goInception

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

goInception 是否能支持MySQL 8.0 中的 with 语法呢 #652

Open callmedba opened 4 months ago

callmedba commented 4 months ago

描述您想要的功能:

MySQL8中支持了with语法,tidb最新版本中也支持了该语法。

goInception 目前是否能支持 with 语法审核呢 ? 谢谢

示例sql:

with x as (select * from movies) select id,movie from x;

可参考文档,资料,引用等:

使用 goInception v1.3.0-90-gb3de05e2e7 对该示例sql进行测试,错误日志为:

level=error msg="con:21 解析失败! line 1 column 4 near \"with x as (select * from movies) select id,movie from x\" " file=session_inception.go func=executeInc line=220
zmix999 commented 4 months ago

得等主分支修复了,可以看下我fork的分支,https://gitee.com/zhoujin826/goInception

callmedba commented 4 months ago

得等主分支修复了,可以看下我fork的分支,https://gitee.com/zhoujin826/goInception

大佬 ,我从gitee上下载了最新版本 v1.3.0-159-gd625352

验证示例sql:

with x as (select * from movies) select id,movie from x;

结果是:

error_level返回 2
error_message 返回 " Table 'pms.x' doesn't exist.Column 'id' not existed.Column 'movie' not existed. "

日志如下:

ime="2024/05/29 16:07:27.823" level=info msg="con:6 new connection 127.0.0.1:36078" file=server.go func=onConn line=319
time="2024/05/29 16:07:27.824" level=info msg="[GENERAL_LOG] con:6 user:root@127.0.0.1 sql:SET AUTOCOMMIT = 0" file=session.go func=logQuery line=1613
time="2024/05/29 16:07:27.932" level=info msg="s.innodbLargePrefix: false " file=session_inception.go func=mysqlServerVersion line=1920
time="2024/05/29 16:07:28.044" level=info msg="[GENERAL_LOG] con:6 user:root@127.0.0.1 sql:/*--user=xxx;--password=xxx;--host=xxx;--check=1;--port=3306;*/ inception_magic_start; use pms; select * from movies; with x as (select * from movies) select id,movie from x; inception_magic_commit;" file=session.go func=logQuery line=1613
time="2024/05/29 16:07:28.045" level=info msg="con:6 close connection" file=server.go func=func1 line=321

请问这个goInception如果要使用MySQL CET语法,是需要打开哪个配置项吗 ? 谢谢

zmix999 commented 4 months ago

提示的不是很明显了,查询的表有这些列吗

zmix999 commented 4 months ago

image

callmedba commented 4 months ago

image

id和movie列在表里是有的 ,有点奇怪

callmedba commented 4 months ago
./goInception -V
Release Version: v1.3.0-159-gd625352
Git Commit Hash: d625352d2ca160cba45a4b4128757ccfc57071bf
Git Branch: master
UTC Build Time: 2024-05-28 13:38:05
GoVersion: go version go1.22.2 linux/amd64

配置文件和社区一致的, v1.3.0-159-gd625352 这个版本是对的吗 ? 谢谢

callmedba commented 4 months ago

image

请问下这个截图里是使用的哪个goInception小版本,我试试看

zmix999 commented 4 months ago

image image image 检查自己的配置吧,错误提示很明显

woshiyanghai commented 3 months ago

我使用goInception-linux-v1.3.0-164-g16a8b6f.tar.gz 这个版本,还是无法使用with语法?请问这个支持了么

zmix999 commented 3 months ago

我使用goInception-linux-v1.3.0-164-g16a8b6f.tar.gz 这个版本,还是无法使用with语法?请问这个支持了么 报什么错