mirror of https://github.com/jackc/pgx.git
parent
d88242b0ca
commit
49b3582977
|
@ -5,6 +5,7 @@
|
||||||
* Fix unrecognized commit failure
|
* Fix unrecognized commit failure
|
||||||
* Fix msgReader.rxMsg bug when msgReader already has error
|
* Fix msgReader.rxMsg bug when msgReader already has error
|
||||||
* Go float64 can no longer be encoded to a PostgreSQL float4
|
* Go float64 can no longer be encoded to a PostgreSQL float4
|
||||||
|
* Fix connection corruption when query with error is closed early
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|
5
query.go
5
query.go
|
@ -101,6 +101,11 @@ func (rows *Rows) readUntilReadyForQuery() {
|
||||||
case dataRow:
|
case dataRow:
|
||||||
case commandComplete:
|
case commandComplete:
|
||||||
case bindComplete:
|
case bindComplete:
|
||||||
|
case errorResponse:
|
||||||
|
err = rows.conn.rxErrorResponse(r)
|
||||||
|
if rows.err == nil {
|
||||||
|
rows.err = err
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
err = rows.conn.processContextFreeMsg(t, r)
|
err = rows.conn.processContextFreeMsg(t, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -135,6 +135,21 @@ func TestConnQueryCloseEarly(t *testing.T) {
|
||||||
ensureConnValid(t, conn)
|
ensureConnValid(t, conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConnQueryCloseEarlyWithErrorOnWire(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
conn := mustConnect(t, *defaultConnConfig)
|
||||||
|
defer closeConn(t, conn)
|
||||||
|
|
||||||
|
rows, err := conn.Query("select 1/0")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("conn.Query failed: %v", err)
|
||||||
|
}
|
||||||
|
rows.Close()
|
||||||
|
|
||||||
|
ensureConnValid(t, conn)
|
||||||
|
}
|
||||||
|
|
||||||
// Test that a connection stays valid when query results read incorrectly
|
// Test that a connection stays valid when query results read incorrectly
|
||||||
func TestConnQueryReadWrongTypeError(t *testing.T) {
|
func TestConnQueryReadWrongTypeError(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
Loading…
Reference in New Issue