Try to discribe issue5546

Try to discribe https://github.com/go-gorm/gorm/issues/5546
This commit is contained in:
ZacamaX 2022-07-27 11:42:17 +08:00 committed by GitHub
parent 3c6eb14c92
commit c68d1477b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -256,3 +256,15 @@ func TestDeleteReturning(t *testing.T) {
t.Errorf("failed to delete data, current count %v", count)
}
}
func TestDeleteReturningTry(t *testing.T) {
if DB.Dialector.Name() != "sqlite" && DB.Dialector.Name() != "postgres" {
return
}
var results []Company
DB.Clauses(clauses.Returing{}).Where(&Company{Name: "try"}).Delete(&results)
// len(results) == 0 and the raw sql does not contain RETURING
}