Skip to content

Commit

Permalink
Skip simple protocol when using prepare stmt, close go-gorm/gorm#5380
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed May 28, 2022
1 parent 4c448a1 commit 3806f45
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,9 @@ func (m Migrator) GetRows(currentSchema interface{}, table interface{}) (*sql.Ro

return m.DB.Session(&gorm.Session{}).Table(name).Limit(1).Scopes(func(d *gorm.DB) *gorm.DB {
// use simple protocol
d.Statement.Vars = append(d.Statement.Vars, pgx.QuerySimpleProtocol(true))
if !m.DB.PrepareStmt {
d.Statement.Vars = append(d.Statement.Vars, pgx.QuerySimpleProtocol(true))
}
return d
}).Rows()
}
Expand Down

0 comments on commit 3806f45

Please sign in to comment.