test: invalid cache plan with prepare stmt
This commit is contained in:
parent
2a788fb20c
commit
af8a53af32
@ -850,7 +850,7 @@ func findColumnType(dest interface{}, columnName string) (
|
||||
return
|
||||
}
|
||||
|
||||
func TestInvalidCachedPlan(t *testing.T) {
|
||||
func TestInvalidCachedPlanSimpleProtocol(t *testing.T) {
|
||||
if DB.Dialector.Name() != "postgres" {
|
||||
return
|
||||
}
|
||||
@ -885,6 +885,41 @@ func TestInvalidCachedPlan(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvalidCachedPlanPrepareStmt(t *testing.T) {
|
||||
if DB.Dialector.Name() != "postgres" {
|
||||
return
|
||||
}
|
||||
|
||||
db, err := gorm.Open(postgres.Open(postgresDSN), &gorm.Config{PrepareStmt: true})
|
||||
if err != nil {
|
||||
t.Errorf("Open err:%v", err)
|
||||
}
|
||||
|
||||
type Object1 struct{}
|
||||
type Object2 struct {
|
||||
Field1 string
|
||||
}
|
||||
type Object3 struct {
|
||||
Field2 string
|
||||
}
|
||||
db.Migrator().DropTable("objects")
|
||||
|
||||
err = db.Table("objects").AutoMigrate(&Object1{})
|
||||
if err != nil {
|
||||
t.Errorf("AutoMigrate err:%v", err)
|
||||
}
|
||||
|
||||
err = db.Table("objects").AutoMigrate(&Object2{})
|
||||
if err != nil {
|
||||
t.Errorf("AutoMigrate err:%v", err)
|
||||
}
|
||||
|
||||
err = db.Table("objects").AutoMigrate(&Object3{})
|
||||
if err != nil {
|
||||
t.Errorf("AutoMigrate err:%v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDifferentTypeWithoutDeclaredLength(t *testing.T) {
|
||||
type DiffType struct {
|
||||
ID uint
|
||||
|
Loading…
x
Reference in New Issue
Block a user