properly delimit reserved word

This commit is contained in:
Jim Lambert 2020-02-13 11:28:11 -05:00
parent aa919e55fb
commit 31d3b83f88

View File

@ -792,7 +792,7 @@ func TestRelated(t *testing.T) {
var creditcard CreditCard
var user3 User
DB.First(&creditcard, "number = ?", "1234567890")
DB.First(&creditcard, `"number" = ?`, "1234567890") // you have to properly quote number as a reserved word
DB.Model(&creditcard).Related(&user3)
if user3.Id != user.Id || user3.Name != user.Name {
t.Errorf("Should get user from credit card correctly")