You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of thanks for the nice package. I have an issue when using the package with sqlx and PostgreSQL. When I use otelsql, sqlx detect the wrong driver type and named queries use ? instead of $1. It also doesn't help to use Rebind.
This is a known limitation of otelsql.Register because it returns a new driver name. sqlx has an internal hard-coded DB driver mapping that requires the exact driver name.
Activity
XSAM commentedon Apr 6, 2026
Hey @rafiwicht, thanks for creating the issue!
This is a known limitation of
otelsql.Registerbecause it returns a new driver name.sqlxhas an internal hard-coded DB driver mapping that requires the exact driver name.https://github.com/jmoiron/sqlx/blob/41dac167fdad5e3fd81d66cafba0951dc6823a30/bind.go#L24-L29
With a custom driver name,
sqlxusesUNKNOWNas the bindtype, thus?stays?.https://github.com/jmoiron/sqlx/blob/41dac167fdad5e3fd81d66cafba0951dc6823a30/bind.go#L74-L81
That is why
otelsqlprovides other methods to address compatible issues like this.In your case,
otelsql.Open+sqlx.NewDb(db, "pgx")should work for you.I will update the doc of
otelsql.Registerto make this limitation clearer.Update doc for Register (#616)