批量Insert时Omit出错 #1143
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#1143
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
在操作mysql时,我在update中去掉end_time字段插入, 下面第一种可以正常进行。
for _, v := range in { _, err := dstSession.Omit("end_time").Insert(v) if err != nil { panic(err) } }
但是,这样会报 Error 1048: Column 'end_time' cannot be null
_, err := dstSession.Omit("end_time").Insert(in....) if err != nil { panic(err) }
这是为啥???
可以提供下详细的日志信息吗,可以通过
Engine.ShowSQL(true)
打开日志输出sql:
程序
结果:
@BetaCat0
我仔细看了下,在代码里你使用了
这看起来是个bug,将会在 https://github.com/go-xorm/xorm/pull/1146 修复。可以先通过
x.Omit("end_time").Insert(im)
(去掉...)来规避这个错误Insert(im)
will fix the problem.