database/sql: correctly guard the query Row preventing early release

When a Tx starts a query, prevent returning the connection to the pool
until after the query finishes.

Fixes #19058

Change-Id: I2c0480d9cca9eeb173b5b3441a5aeed6f527e0ac
Reviewed-on: https://go-review.googlesource.com/40400
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Daniel Theophanes 2017-04-07 12:21:50 -07:00
parent 10a200e560
commit dec95d8fad
2 changed files with 13 additions and 6 deletions

View file

@ -2997,7 +2997,6 @@ func TestIssue18719(t *testing.T) {
// canceled context.
cancel()
waitForRowsClose(t, rows, 5*time.Second)
}
func TestConcurrency(t *testing.T) {