Merge pull request #335 from BillBuilt/on-conflict-do-nothing-without-conflict-target
ON CONFLICT DO NOTHING without a conflict target is valid SQL
This commit is contained in:
commit
60d8f15513
2 changed files with 3 additions and 2 deletions
|
|
@ -44,7 +44,7 @@ func (o *onConflictClause) DO_UPDATE(action conflictAction) InsertStatement {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *onConflictClause) Serialize(statementType jet.StatementType, out *jet.SQLBuilder, options ...jet.SerializeOption) {
|
func (o *onConflictClause) Serialize(statementType jet.StatementType, out *jet.SQLBuilder, options ...jet.SerializeOption) {
|
||||||
if len(o.indexExpressions) == 0 && o.constraint == "" {
|
if len(o.indexExpressions) == 0 && o.constraint == "" && o.do != jet.Keyword("DO NOTHING") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ func TestOnConflict(t *testing.T) {
|
||||||
|
|
||||||
onConflict := &onConflictClause{}
|
onConflict := &onConflictClause{}
|
||||||
onConflict.DO_NOTHING()
|
onConflict.DO_NOTHING()
|
||||||
assertClauseSerialize(t, onConflict, "")
|
assertClauseSerialize(t, onConflict, `
|
||||||
|
ON CONFLICT DO NOTHING`)
|
||||||
|
|
||||||
onConflict = &onConflictClause{indexExpressions: ColumnList{table1ColBool}}
|
onConflict = &onConflictClause{indexExpressions: ColumnList{table1ColBool}}
|
||||||
onConflict.DO_NOTHING()
|
onConflict.DO_NOTHING()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue