mirror of
https://gitee.com/johng/gf
synced 2026-07-06 13:42:46 +08:00
up
This commit is contained in:
@ -76,8 +76,13 @@ func (d *Driver) doMergeInsert(
|
||||
}
|
||||
foundPrimaryKey := false
|
||||
for _, primaryKey := range primaryKeys {
|
||||
if _, ok := list[0][primaryKey]; ok {
|
||||
foundPrimaryKey = true
|
||||
for dataKey := range list[0] {
|
||||
if strings.EqualFold(dataKey, primaryKey) {
|
||||
foundPrimaryKey = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if foundPrimaryKey {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ package pgsql
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/errors/gcode"
|
||||
@ -37,9 +38,14 @@ func (d *Driver) DoInsert(
|
||||
)
|
||||
}
|
||||
foundPrimaryKey := false
|
||||
for _, conflictKey := range primaryKeys {
|
||||
if _, ok := list[0][conflictKey]; ok {
|
||||
foundPrimaryKey = true
|
||||
for _, primaryKey := range primaryKeys {
|
||||
for dataKey := range list[0] {
|
||||
if strings.EqualFold(dataKey, primaryKey) {
|
||||
foundPrimaryKey = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if foundPrimaryKey {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user