thunguo commented on code in PR #1136:
URL:
https://github.com/apache/incubator-seata-go/pull/1136#discussion_r3542749798
##########
pkg/datasource/sql/exec/at/insert_executor.go:
##########
@@ -707,7 +723,7 @@ func (i *insertExecutor) getPkValuesByAuto(ctx
context.Context, execCtx *types.E
// If there is batch insert
// do auto increment base LAST_INSERT_ID and variable
`auto_increment_increment`
- if lastInsertId > 0 && updateCount > 1 && canAutoIncrement(pkMetaMap) {
+ if lastInsertId > 0 && updateCount > 1 {
Review Comment:
这里为什么去掉`canAutoIncrement`检查?保留然后做复合主键的适配逻辑是不是好一些?
##########
pkg/datasource/sql/exec/at/insert_executor.go:
##########
@@ -487,17 +487,25 @@ func (i *insertExecutor) getPkIndex(InsertStmt
*ast.InsertStmt, meta types.Table
return pkIndexMap
}
insertColumnsSize := len(InsertStmt.Columns)
- if insertColumnsSize == 0 {
+ if meta.ColumnNames == nil {
return pkIndexMap
}
- if meta.ColumnNames == nil {
+ if insertColumnsSize == 0 {
+ if len(InsertStmt.Lists) == 0 {
+ return pkIndexMap
+ }
+ for idx, columnName := range meta.ColumnNames {
+ if pkColumnName, ok := i.matchPKColumnName(columnName,
meta); ok {
+ pkIndexMap[pkColumnName] = idx
+ }
Review Comment:
这里可以补充个注释备注下维护顺序的原因,方便后面维护
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]