-
Notifications
You must be signed in to change notification settings - Fork 283
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
only inserted fields #719
base: master
Are you sure you want to change the base?
only inserted fields #719
Conversation
Quality Gate failedFailed conditions |
selectFieldsStr = strings.Join(meta.ColumnNames, ",") | ||
} | ||
|
||
sb.WriteString("SELECT " + selectFieldsStr + " FROM " + meta.TableName + " ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
insert_test 单元测试得修改下
@@ -184,9 +184,12 @@ func (i *insertExecutor) buildAfterImageSQL(ctx context.Context) (string, []driv | |||
} | |||
// build check sql | |||
sb := strings.Builder{} | |||
sb.WriteString("SELECT * FROM " + tableName) | |||
suffix := strings.Builder{} | |||
sb.WriteString("SELECT " + strings.Join(pkColumnNameList, ", ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里只 select 主键字段吗?应该是选择 insert 中带的字段比较合理?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外,除了要把 insert 的字段查出来,还需要把有默认值的字段也查出来?这些字段的修改也可能导致脏回滚
@@ -132,9 +132,12 @@ func (u *MySQLInsertUndoLogBuilder) buildAfterImageSQL(ctx context.Context, exec | |||
} | |||
// build check sql | |||
sb := strings.Builder{} | |||
sb.WriteString("SELECT * FROM " + tableName) | |||
suffix := strings.Builder{} | |||
sb.WriteString("SELECT " + strings.Join(pkColumnNameList, ", ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同理如上
What this PR does:
optimize: only the inserted fields are checked
Which issue(s) this PR fixes:
#697
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: