-
Notifications
You must be signed in to change notification settings - Fork 197
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
gorm postgres v1.5.0 return panic: sql: Register called twice for driver pgx #1414
Comments
Could you provide a code sample which reproduces this issue? |
me too panic: sql: Register called twice for driver pgx
goroutine 1 [running]:
database/sql.Register({0x10313f7eb, 0x3}, {0x103675b40, 0x1400000e258})
/opt/homebrew/Cellar/go/1.20.1/libexec/src/database/sql/sql.go:51 +0x124
github.com/jackc/pgx/v4/stdlib.init.0()
/usr/local/go/pkg/mod/github.com/jackc/pgx/[email protected]/stdlib/sql.go:87 +0xb4
exit status 2 my code import (
postgres "go.elastic.co/apm/module/apmgormv2/v2/driver/postgres"
"gorm.io/gorm"
)
func Conn() (*gorm.DB, error) {
db, err := gorm.Open(postgres.Open("host=localhost port=5432 user=postgres password=1234 dbname=test"), &gorm.Config{})
if err != nil {
panic("db conn error")
}
return db, err
} go.mod file
|
I'm sorry, but I'm unable to reproduce your issue with the code you provided.
go.mod has all libraries on their latest versions (generated with |
thanks for you |
I have the same problem.
|
is there any update about this issue ? panic: sql: Register called twice for driver pgx
database/sql.Register({0x139a5af, 0x3}, {0x1766120, 0xc0004b6558})
/usr/local/go/src/database/sql/sql.go:51 +0x13d
/go/pkg/mod/github.com/jackc/pgx/[email protected]/stdlib/sql.go:87 +0xa7 |
just found out, i imported it manually the module pgxv4 without using the driver Postgres from Gorm, and that solve my problem
|
Describe the bug
Basically, I am trying to instrument my database but it is returning an error.
To Reproduce
Steps to reproduce the behavior:
go.elastic.co/apm/module/apmgormv2/v2 v2.3.0
gorm.io/driver/postgres v1.5.0 // indirect
panic: sql: Register called twice for driver pgx
goroutine 1 [running]:
database/sql.Register({0x12b187f, 0x3}, {0x1519b00, 0xc00011e288})
/usr/local/go/src/database/sql/sql.go:54 +0x185
github.com/jackc/pgx/v4/stdlib.init.0()
/home/felipe/go/pkg/mod/github.com/jackc/pgx/[email protected]/stdlib/sql.go:87 +0xa7
exit status 2
make: *** [Makefile:5: start] Erro 1
Expected behavior
A clear and concise description of what you expected to happen.
The text was updated successfully, but these errors were encountered: