Skip to content

Commit 096c357

Browse files
committed
Only enable simple protocal for pgx
1 parent e6ed2df commit 096c357

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

migrator.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,9 @@ func (m Migrator) GetRows(currentSchema interface{}, table interface{}) (*sql.Ro
527527
}
528528

529529
return m.DB.Session(&gorm.Session{}).Table(name).Limit(1).Scopes(func(d *gorm.DB) *gorm.DB {
530+
dialector, _ := m.Dialector.(Dialector)
530531
// use simple protocol
531-
if !m.DB.PrepareStmt && len(d.Statement.Vars) != 0 {
532+
if !m.DB.PrepareStmt && (dialector.Config != nil && (dialector.Config.DriverName == "" || dialector.Config.DriverName == "pgx")) {
532533
d.Statement.Vars = append(d.Statement.Vars, pgx.QuerySimpleProtocol(true))
533534
}
534535
return d

0 commit comments

Comments
 (0)