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: confusing documentation for Rows.Columns #27202

Closed
AlekSi opened this issue Aug 24, 2018 · 4 comments
Closed

database/sql: confusing documentation for Rows.Columns #27202

AlekSi opened this issue Aug 24, 2018 · 4 comments

Comments

@AlekSi
Copy link
Contributor

AlekSi commented Aug 24, 2018

https://tip.golang.org/pkg/database/sql/#Rows.Columns says:

Columns returns the column names. Columns returns an error if the rows are closed, or if the rows are from QueryRow and there was a deferred error.

That latter part does not make sense: it is not possible to convert Row (returned by QueryRow) to Rows.

Unless I miss something, that part should be removed.

@meirf
Copy link
Contributor

meirf commented Aug 25, 2018

If this is a mistake I'm surprised it hasn't been found yet. Your "not make sense" logic seems to apply equally to the original code: https://codereview.appspot.com/5483088/diff/4001/src/pkg/exp/sql/sql.go

@AlekSi
Copy link
Contributor Author

AlekSi commented Sep 2, 2018

/cc @kardianos

@kardianos
Copy link
Contributor

@AlekSi I believe you are correct. Feel free to send a CL to fix, or I will later.

@kardianos kardianos self-assigned this Sep 3, 2018
AlekSi added a commit to AlekSi/go that referenced this issue Sep 3, 2018
Fixes golang#27202

Change-Id: I3e3bdb1c8d655deb6fdd374868fcac0621f8fa0c
@gopherbot
Copy link

Change https://golang.org/cl/133057 mentions this issue: database/sql: fix Rows.Columns() documentation

@golang golang locked and limited conversation to collaborators Sep 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants