Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatabaseValidations: true gives not informative error #21

Open
AlexanderMatveev opened this issue Oct 4, 2023 · 1 comment
Open

DatabaseValidations: true gives not informative error #21

AlexanderMatveev opened this issue Oct 4, 2023 · 1 comment

Comments

@AlexanderMatveev
Copy link

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 "\"
@AlexanderMatveev
Copy link
Author

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 "\"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant