handle this not like an idiot

pull/54/head
Karl Seguin 2014-12-24 09:16:13 +07:00
parent 8d116336c3
commit edc8216aa2
3 changed files with 4 additions and 6 deletions

View File

@ -191,10 +191,6 @@ func (r *msgReader) readBytes(count int32) []byte {
return nil
}
if count < 1 {
return nil
}
b := make([]byte, int(count))
_, err := io.ReadFull(r.reader, b)

View File

@ -822,12 +822,10 @@ func TestReadingNullByteArray(t *testing.T) {
}
}
func TestReadingNullByteArrays(t *testing.T) {
conn := mustConnect(t, *defaultConnConfig)
defer closeConn(t, conn)
rows, err := conn.Query("select null::text union all select null::text")
if err != nil {
t.Fatalf("conn.Query failed: ", err)

View File

@ -113,6 +113,10 @@ func (r *ValueReader) ReadBytes(count int32) []byte {
return nil
}
if count == -1 {
return nil
}
r.valueBytesRemaining -= count
if r.valueBytesRemaining < 0 {
r.Fatal(errors.New("read past end of value"))