Skip to content
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

database/sql: Implementations of ExecerContext should not require Execer #21084

flimzy opened this issue Jul 19, 2017 · 1 comment

database/sql: Implementations of ExecerContext should not require Execer #21084

flimzy opened this issue Jul 19, 2017 · 1 comment


Copy link

@flimzy flimzy commented Jul 19, 2017

What version of Go are you using (go version)?

Go 1.8.3

What did you do?

I have implemented an instance of an sql/driver with a Conn instance that satisfies the ExecerContext interface. But unless the Conn also satisfies the Execer interfaces respectfully, the *Context versions are never called.

(Note, the same issue exists with respect to QueryerContext and Queryer, but for simplicity I will only discuss Execer/Context)

Further, when both Execer and ExecerContext are satisfied, or both Queryer and QueryerContext are satisfied, the non-Context version is never called, meaning all drivers that wish to satisfy the Context version must also define a useless non-Context version (example).

What did you expect to see?

I expected that implementing an ExecerContext would be sufficient to satisfy the documented "optional" nature of the interface.

What did you see instead?

I was required to also satisify the Execer interface, even though this requirement is not to my knowledge documented, nor should it be functionally necessary.


Re-factor the database/sql package to require only one of the interfaces to be satisfied, not both.

Copy link

@kardianos kardianos commented Sep 9, 2017

I'm going to close this issue in favor of #21663 as it include both Queryer and Execer.

@kardianos kardianos closed this Sep 9, 2017
@golang golang locked and limited conversation to collaborators Sep 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.