orm
orm copied to clipboard
DatabaseValidations: true gives not informative error
if err := orm.SetupConnections(orm.ConnectionConfig{
DB: db,
Dialect: orm.Dialects.PostgreSQL,
Entities: []orm.Entity{
//...
},
DatabaseValidations: true,
}); err != nil {
log.Fatalf("orm.SetupConnections: %v", err)
}
2023/10/04 14:52:44 orm.SetupConnections: pq: syntax error at or near "\"
Looks like this happens because of "\dt" is failing with database/sql
db, err := sql.Open("postgres", conf.DatabaseUrl)
if err != nil {
log.Fatal(err)
}
if _, err := db.Exec("\\dt"); err != nil {
log.Fatalf("db.Exec: %v", err)
}
// 2023/10/04 14:57:35 db.Exec: pq: syntax error at or near "\"