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: document stateful / pooling rules better #3223

Closed
bradfitz opened this issue Mar 6, 2012 · 2 comments
Closed

database/sql: document stateful / pooling rules better #3223

bradfitz opened this issue Mar 6, 2012 · 2 comments
Assignees
Milestone

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Mar 6, 2012

Per discussions / confusion with Heroku folk, it's obvious that the sql package's docs
are lacking.

Document that there is no "session context" in the sql package.  Or rather,
that the *DB is the session context, but once the session context (the *DB) is used by
multiple goroutines, then session context is shared.  We currently say "It's safe
for concurrent use by multiple goroutines.", which is true, and is the common case,
but that should elaborate more about what exactly tha means.

And document that a *Tx is a "session". (~bound to a conn==session), and once
the Tx is Committed or rolled back, the session is lost.  (session being SQL local
variables and such)

If you want multiple concurrent long-lived multi-Tx "sessions", each client
should do its own sql.Open and not share its *DB with others.
@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Mar 6, 2012

Comment 1:

Labels changed: added documentation.

@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Mar 7, 2012

Comment 3:

This issue was closed by revision 502e29f.

Status changed to Fixed.

@bradfitz bradfitz self-assigned this Mar 7, 2012
@rsc rsc added this to the Go1 milestone Apr 10, 2015
@rsc rsc removed the priority-go1 label Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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
3 participants
You can’t perform that action at this time.