Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
philband committed Dec 23, 2020
1 parent 6a95bfb commit e49726c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dialect_postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ func (p *postgresql) Create(s store, model *Model, cols columns.Columns) error {
}
switch keyType {
case "int", "int64":
cols.Remove(model.IDField())
if model.ID() == 0 {
cols.Remove(model.IDField())
} else {
cols.Cols[model.IDField()].Writeable = true
}
w := cols.Writeable()
var query string
if len(w.Cols) > 0 {
Expand Down

0 comments on commit e49726c

Please sign in to comment.