Here is the simplified code:
conn, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})tb := conn.Table("test1")
tmp := []testdb{}
tb.Where("tid=?", "1").Find(&tmp)
//This line of code executes the statement:
//select * from test1 where tid=1
//tb.Debug.Where("tid=?", "1").Find(&tmp) //print same statement
tb.Where("tid=?", "2").Find(&tmp)
//this line excutes select * from test1 where tid=1 and tid=2
//tb.Debug.Where("tid=?", "1").Find(&tmp)
//executes:select * from test1 where tid=2
I don't understand why two Where() become "tid=1 and tid=2", and why Debug() is normal.thanks for the hand!