mysql自增主键,在insert的时候 显示"Error 1364: Field 'id' doesn't have a default value" #1090
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
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#1090
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?
表设置的 自增主键.
结构体id为0值,
engineer.ShowSQL(true)
这部分也没问题
type A struct{
Id int
json:"id" xorm:"not null pk autoincr INT(11)"
}
报错返回
这是什么原因
报得什么错? 加个unique 约束试试
Id int
json:"id" xorm:"not null pk autoincr unique INT(11)"
有可能你的数据是重复的。
另外最外边需要加`` 反引号