-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
sql: unknown driver "postgres" #51
Comments
Why are you using |
https://pkg.go.dev/gorm.io/driver/postgres@v1.1.0?utm_source=gopls#Config
For custom configurations (example: max number of connections in the idle connection pool, max number of open connections in the database, etc.), I am using |
Did you try to use the gorm implementation of these features as seen here? https://gorm.io/docs/connecting_to_the_database.html#Connection-Pool |
Yes exactly. You can see the full code here (facing issue only with postgres): |
Your Question
It fails to establish a connection with the PostgreSQL database.
Error message:
sql: unknown driver "postgres" (forgotten import?)
The document you expected this should be explained
official documents site
Expected answer
With MySQL and SQLite3 drivers
gorm.io/driver/mysql
,gorm.io/driver/sqlite
, everything works perfectly fine.Temporary workaround
By importing
_ "github.com/jinzhu/gorm/dialects/postgres"
along with"gorm.io/driver/postgres"
, connection with PostgreSQL database works smoothly.So, why isn't
"gorm.io/driver/postgres"
works without importing_ "github.com/jinzhu/gorm/dialects/postgres"
? Am I missing something?Thank you in advance.
The text was updated successfully, but these errors were encountered: