mirror of https://github.com/go-gorm/gorm.git
Fix OnConflict where order for postgres, close #4073
This commit is contained in:
parent
84ea3ec0cc
commit
a13b7a6acb
clause
|
@ -26,12 +26,6 @@ func (onConflict OnConflict) Build(builder Builder) {
|
||||||
builder.WriteString(`) `)
|
builder.WriteString(`) `)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(onConflict.Where.Exprs) > 0 {
|
|
||||||
builder.WriteString("WHERE ")
|
|
||||||
onConflict.Where.Build(builder)
|
|
||||||
builder.WriteByte(' ')
|
|
||||||
}
|
|
||||||
|
|
||||||
if onConflict.OnConstraint != "" {
|
if onConflict.OnConstraint != "" {
|
||||||
builder.WriteString("ON CONSTRAINT ")
|
builder.WriteString("ON CONSTRAINT ")
|
||||||
builder.WriteString(onConflict.OnConstraint)
|
builder.WriteString(onConflict.OnConstraint)
|
||||||
|
@ -44,6 +38,12 @@ func (onConflict OnConflict) Build(builder Builder) {
|
||||||
builder.WriteString("DO UPDATE SET ")
|
builder.WriteString("DO UPDATE SET ")
|
||||||
onConflict.DoUpdates.Build(builder)
|
onConflict.DoUpdates.Build(builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(onConflict.Where.Exprs) > 0 {
|
||||||
|
builder.WriteString("WHERE ")
|
||||||
|
onConflict.Where.Build(builder)
|
||||||
|
builder.WriteByte(' ')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MergeClause merge onConflict clauses
|
// MergeClause merge onConflict clauses
|
||||||
|
|
Loading…
Reference in New Issue