Skip to content

Commit

Permalink
fix: 修复update指定表别名时审核错误的问题(fix #249)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanchuanchuan committed Jul 23, 2020
1 parent 67e1ed1 commit c3d39d8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion session/session_inception.go
Original file line number Diff line number Diff line change
Expand Up @@ -6333,7 +6333,11 @@ func (s *session) checkUpdate(node *ast.UpdateStmt, sql string) {
for _, l := range node.List {
// 未指定表别名时加默认设置
if l.Column.Table.L == "" && len(tableInfoList) == 1 {
l.Column.Table = model.NewCIStr(s.myRecord.TableInfo.Name)
if s.myRecord.TableInfo.AsName != "" {
l.Column.Table = model.NewCIStr(s.myRecord.TableInfo.AsName)
} else {
l.Column.Table = model.NewCIStr(s.myRecord.TableInfo.Name)
}
}

if s.checkFieldItem(l.Column, tableInfoList) {
Expand Down

0 comments on commit c3d39d8

Please sign in to comment.