Skip to content

Support for upcoming driver.RowsColumnScanner interface #557

Closed

Description

@moripaku

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.

Activity

  1. added
    enhancement
    on Nov 1, 2025
  2. XSAM commented on Nov 13, 2025

    @XSAM
    Owner

    Hi @moripaku, thanks for the heads up.

    I am not sure there is anything that needs to be done on the otelsql side, as it does not wrap *sql.DB. So, it does not interfere with the Scan method. (I was wrong after checking the Go source code, https://go-review.googlesource.com/c/go/+/588435)

    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).

  3. moripaku commented on Nov 14, 2025

    @moripaku
    Author

    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:

    1. 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)

    1. It is possible to define local version of interface, e.g.
    type myLocalRowsColumnScanner interface {
    	driver.Rows // optional, but for completeness
    	ScanColumn(i int, dest any) 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.

    1. Use reflection to check if driver has a method of this specific signature, which is more or less a variant of 2.
  4. XSAM commented on Nov 14, 2025

    @XSAM
    Owner

    @moripaku Thanks for the well explained proposal! I’d like to use option 1 when Go 1.26 comes out.

  5. added this to the v0.42.0 milestone on Dec 16, 2025
  6. modified the milestones: v0.42.0, v0.43.0 on Mar 31, 2026
  7. XSAM commented on Apr 30, 2026

    @XSAM
    Owner

    Looks like the original change has been reverted and switched to the new design. And, driver.RowsColumnScanner is not included in the Go 1.26.

    I will wait for Go 1.27.

  8. modified the milestones: v0.43.0, v0.45.0 on Apr 30, 2026
  9. modified the milestones: v0.45.0, v0.44.0 on Sep 4, 2026
  10. added a commit that references this issue on Nov 12, 2026
    a7f3be3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions