-
Notifications
You must be signed in to change notification settings - Fork 18k
database/sql: prepared statements are bound to connections, autoreconnection doesn't work #5718
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
Labels
Comments
Labels changed: added priority-later, removed priority-triage. Owner changed to @bradfitz. Status changed to Accepted. |
Mailed https://golang.org/cl/14920046 I think this shouldn't be postponed to after Go 1.2. Not working auto-reconnecting for prepared statements is a serious flaw IMO. This is a thing the user should not have to care about and the database/sql package makes this promise. |
The current code causes an especially critical bug in stmt.Exec: http://code.google.com/p/go/source/browse/src/pkg/database/sql/sql.go#1252 The connection is put back to the connection pool even if resultFromStatement returned an error. This can lead to nasty panics if the driver does not completely distrust the database/sql package and assumes that no connections marked by ErrBadConn are reused. Here is one example case by better0332 where this happened: go-sql-driver/mysql#142 I'm still of the opinion that this bug should be fixed in Go 1.2. From my point of view this bug is very critical. My current advise would be not to use prepared statements with the database/sql package unless the code is manually patched. And certainly not in production. |
This issue was closed by revision 762a9d9. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: