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

含有inner join的update检测出问题 #112

Closed
phaibin opened this issue Nov 15, 2019 · 18 comments
Closed

含有inner join的update检测出问题 #112

phaibin opened this issue Nov 15, 2019 · 18 comments
Labels
wontfix This will not be worked on

Comments

@phaibin
Copy link

phaibin commented Nov 15, 2019

描述

对于含有inner join的正确update语句检测出问题

重现

UPDATE tickets ts join test t on ts.id = t.id 
set ts.status = 1, t.age = 1
where ts.id = 1

检测出现错误:

Column 'tickets.age' not existed.

环境

数据库: mysql
版本: 5.6.39
goInception版本:1.1.3

参数

# IP地址
host = "0.0.0.0"
# 端口
port = 4000
# TiDB数据库目录
path = "/tmp/tidb"

[log]
# 日志级别: debug, info, warn, error, fatal.
level = "info"

# 日志格式, one of json, text, console.
format = "text"

# 禁用时间戳输出
disable-timestamp = false

# 日志文件
[log.file]
# 日志文件名
filename = ""
# 日志文件的最大上限(MB)
max-size = 300
# Max日志文件的保存天数,默认值 `0`,即不清理
max-days = 0
# 要保留的最大旧日志文件数,默认值 `0`,即不清理
max-backups = 0
# 日志轮询,默认值 `true`,即开启
log-rotate = true

[inc]

backup_host = "192.168.18.110"
backup_port = 3307
backup_user = "root"
backup_password = "123456"
max_update_rows = 10000000
check_primary_key = true
enable_blob_type = true
enable_identifer_keyword = true
enable_column_charset = true
enable_minimal_rollback = true

[osc]

osc_min_table_size = 0

[ghost]

ghost_on = true
ghost_aliyun_rds = true
ghost_allow_on_master = true
ghost_assume_rbr = true
ghost_approve_renamed_columns = true

[inc_level]
@hanchuanchuan
Copy link
Owner

暂不支持update多表的情况。

@phaibin
Copy link
Author

phaibin commented Nov 17, 2019

好吧,貌似我们的使用频率还蛮高的,希望尽快能支持!谢谢!

@hanchuanchuan
Copy link
Owner

update多表需要考虑回滚的问题(对多个表均生成回滚SQL),所以修复比较慢,已经在进行中了。

@phaibin
Copy link
Author

phaibin commented Nov 22, 2019

👍

@zwunix
Copy link

zwunix commented Nov 28, 2019

也遇到了。希望尽快支持喔。

@hanchuanchuan
Copy link
Owner

V1.1.5 已发布。
支持update多表更新语法审核(暂不支持多表回滚)。

@zwunix
Copy link

zwunix commented Dec 10, 2019

例如:;
......
......
......
select
'H006' as code,
'已分配,开始操作' as pro
union all
select
'TECH007' as code,
'材料收集撰写中' as processName
union all
select
'TECH008' as code,
'材料已提交申报' as processName
union all
select
'H009' as code,
'服务完成' as pro
) t on d.name = t.pro
set
c.dimension = 3,
c.dictKey = 'tech',
d.value = t.code
where
m.key in (
'SP_SUBSTATE',
'NORMAL_SUBSTATE',
'CHILD_SUBSTATE',
'TECH_MAIN_SUBSTATE'
)
and c.key = 's';
这种构造了中间件表t的多表update语句在代码里能实现吗?

@hanchuanchuan
Copy link
Owner

语法是支持的吧,你可以试试看,有问题继续在此交流即可

@phaibin
Copy link
Author

phaibin commented Dec 10, 2019

我的问题已修复,谢谢作者!
@zwunix 这个issue我先不关闭,你再测试一下

@zwunix
Copy link

zwunix commented Dec 10, 2019

也是报类似错误的呢,就是提示列不存在。

error Column 't.pro' not existed.

@zwunix
Copy link

zwunix commented Dec 10, 2019

@phaibin 好的呢。多谢啦。

@hanchuanchuan
Copy link
Owner

@zwunix union的问题修复过了,请选择 V1.1.5-4 及之后版本

@zwunix
Copy link

zwunix commented Dec 10, 2019

@hanchuanchuan 好的。多谢。已经验证了。

@phaibin
Copy link
Author

phaibin commented Dec 10, 2019

@zwunix 那我关掉了

@hanchuanchuan
Copy link
Owner

update set多表时已支持多表回滚,回滚SQL记录在set第一个字段对应的表中。

相关PR(含示例): #136

@phaibin
Copy link
Author

phaibin commented Dec 17, 2019

👌

@zwunix
Copy link

zwunix commented Dec 17, 2019

@stale
Copy link

stale bot commented Dec 31, 2019

由于此问题没有最近的活动,因此已被自动标记为陈旧。如果没有进一步的活动,会作为不活跃issue关闭。感谢你对本项目的贡献。 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Dec 31, 2019
@stale stale bot closed this as completed Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants