Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
database/sql: document stateful / pooling rules better #3223
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.