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
{{ message }}
Repository navigation
Support for upcoming driver.RowsColumnScanner interface #557
In light of golang/go#67546 that is recently landed in go master branch, please consider adding support for driver.RowsColumnScanner interface in future versions, so custom row scanning capability of sql drivers (pgx in particular) would not be hidden from stdlib layer.
I would like to support this new interface, but otelsql has a compatibility matrix that needs to support at least two minor versions of Go. The moment to put Go 1.26 as the minimal supported version could be Aug 2026 (the release date of Go 1.27).
Without the interface support, it would not be possible for pgx to provide scanning of pgx types, extending the dependency on old pq types. Given that pq is adversely affecting tracing by lacking context support on internal methods ( lib/pq#786 (comment) ), it makes sense to aid in ridding of pq completely in context of this project.
There are several options to provide support for such interface without introducing hard dependency:
Build tags seem to allow adding support for new types and features without introducing hard dependencies, particularly
a term for each Go major release, through the current version: "go1.1" from Go version 1.1 onward, "go1.12" from Go 1.12, and so on.
as such,
//go:build go1.26
will target >=1.26
and
//go:build !go1.26
will target <=1.25 (and technically >= 1.16, since it was // +build before that)
It is possible to define local version of interface, e.g.
typemyLocalRowsColumnScannerinterface {
driver.Rows// optional, but for completenessScanColumn(iint, destany) error
}
without having to depend on stdlib interface version when checking if driver implements such interface, and if go version is 1.25 or less, ScanColumn implementation on otelsql side would simply be never called. Interfaces are just contracts on methods after all, there is no difference between driver.RowsColumnScanner and foo.RowsColumnScanner so long method signatures are the same.
Use reflection to check if driver has a method of this specific signature, which is more or less a variant of 2.
Activity
XSAM commentedon Nov 13, 2025
Hi @moripaku, thanks for the heads up.
I am not sure there is anything that needs to be done on the(I was wrong after checking the Go source code, https://go-review.googlesource.com/c/go/+/588435)otelsqlside, as it does not wrap*sql.DB. So, it does not interfere with theScanmethod.I would like to support this new interface, but
otelsqlhas a compatibility matrix that needs to support at least two minor versions of Go. The moment to put Go1.26as the minimal supported version could be Aug 2026 (the release date of Go1.27).moripaku commentedon Nov 14, 2025
Without the interface support, it would not be possible for pgx to provide scanning of pgx types, extending the dependency on old pq types. Given that pq is adversely affecting tracing by lacking context support on internal methods ( lib/pq#786 (comment) ), it makes sense to aid in ridding of pq completely in context of this project.
There are several options to provide support for such interface without introducing hard dependency:
as such,
//go:build go1.26will target >=1.26
and
//go:build !go1.26will target <=1.25 (and technically >= 1.16, since it was
// +buildbefore that)without having to depend on stdlib interface version when checking if driver implements such interface, and if go version is 1.25 or less, ScanColumn implementation on otelsql side would simply be never called. Interfaces are just contracts on methods after all, there is no difference between
driver.RowsColumnScannerandfoo.RowsColumnScannerso long method signatures are the same.XSAM commentedon Nov 14, 2025
@moripaku Thanks for the well explained proposal! I’d like to use option 1 when Go 1.26 comes out.
XSAM commentedon Apr 30, 2026
Looks like the original change has been reverted and switched to the new design. And,
driver.RowsColumnScanneris not included in the Go1.26.I will wait for Go
1.27.Support RowsColumnScanner on Go 1.27 (XSAM#649)