mirror of https://github.com/jackc/pgx.git
parent
c195d9bb96
commit
3c61b16776
4
query.go
4
query.go
|
@ -196,6 +196,10 @@ func (rows *Rows) nextColumn() (*ValueReader, bool) {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rows.vr.Len() > 0 {
|
||||||
|
rows.mr.readBytes(rows.vr.Len())
|
||||||
|
}
|
||||||
|
|
||||||
fd := &rows.fields[rows.columnIdx]
|
fd := &rows.fields[rows.columnIdx]
|
||||||
rows.columnIdx++
|
rows.columnIdx++
|
||||||
size := rows.mr.readInt32()
|
size := rows.mr.readInt32()
|
||||||
|
|
|
@ -786,3 +786,23 @@ func TestQueryRowCoreStringSlice(t *testing.T) {
|
||||||
|
|
||||||
ensureConnValid(t, conn)
|
ensureConnValid(t, conn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestReadingValueAfterEmptyArray(t *testing.T) {
|
||||||
|
conn := mustConnect(t, *defaultConnConfig)
|
||||||
|
defer closeConn(t, conn)
|
||||||
|
|
||||||
|
var a []string
|
||||||
|
var b int32
|
||||||
|
err := conn.QueryRow("select '{}'::text[], 42::integer").Scan(&a, &b)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("conn.QueryRow failed: ", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(a) != 0 {
|
||||||
|
t.Errorf("Expected 'a' to have length 0, but it was: ", len(a))
|
||||||
|
}
|
||||||
|
|
||||||
|
if b != 42 {
|
||||||
|
t.Errorf("Expected 'b' to 42, but it was: ", b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue