Skip to content

Commit 3806f45

Browse files
committed
Skip simple protocol when using prepare stmt, close go-gorm/gorm#5380
1 parent 4c448a1 commit 3806f45

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

migrator.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,9 @@ func (m Migrator) GetRows(currentSchema interface{}, table interface{}) (*sql.Ro
477477

478478
return m.DB.Session(&gorm.Session{}).Table(name).Limit(1).Scopes(func(d *gorm.DB) *gorm.DB {
479479
// use simple protocol
480-
d.Statement.Vars = append(d.Statement.Vars, pgx.QuerySimpleProtocol(true))
480+
if !m.DB.PrepareStmt {
481+
d.Statement.Vars = append(d.Statement.Vars, pgx.QuerySimpleProtocol(true))
482+
}
481483
return d
482484
}).Rows()
483485
}

0 commit comments

Comments
 (0)