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: possible inconsistent handling of types in convertAssign #18101

Closed
kardianos opened this issue Nov 29, 2016 · 2 comments
Closed

database/sql: possible inconsistent handling of types in convertAssign #18101

kardianos opened this issue Nov 29, 2016 · 2 comments
Assignees
Milestone

Comments

@kardianos
Copy link
Contributor

@kardianos kardianos commented Nov 29, 2016

See #15174 (comment)

In convertAssign, we check for numbers but not strings. If this is intentional it should documented why, otherwise consider adding checks for string types.

@kardianos
Copy link
Contributor Author

@kardianos kardianos commented Mar 30, 2017

I think we should add these checks to the default converter for consistency. The code is small and aligns well with the rest of the driver.IsValid checks.

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 30, 2017

CL https://golang.org/cl/39031 mentions this issue.

@gopherbot gopherbot closed this in 5a45a15 Mar 31, 2017
lparth added a commit to lparth/go that referenced this issue Apr 13, 2017
User defined numeric types such as "type Int int64" have
been able to be scanned into without a custom scanner by
using the reflect scan code path used to convert between
various numeric types. Add in a path for string types
for symmetry and least surprise.

Fixes golang#18101

Change-Id: I00553bcf021ffe6d95047eca0067ee94b54ff501
Reviewed-on: https://go-review.googlesource.com/39031
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@golang golang locked and limited conversation to collaborators Mar 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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