diff --git a/hstore.go b/hstore.go index 18b413c6..c2de1ccf 100644 --- a/hstore.go +++ b/hstore.go @@ -142,8 +142,8 @@ func (dst *Hstore) DecodeBinary(ci *ConnInfo, src []byte) error { var valueBuf []byte if valueLen >= 0 { valueBuf = src[rp : rp+valueLen] + rp += valueLen } - rp += valueLen var value Text err := value.DecodeBinary(ci, valueBuf) diff --git a/hstore_test.go b/hstore_test.go index dce8baf2..48b4b42e 100644 --- a/hstore_test.go +++ b/hstore_test.go @@ -21,6 +21,10 @@ func TestHstoreTranscode(t *testing.T) { &pgtype.Hstore{Map: map[string]pgtype.Text{"NULL": text("bar")}, Status: pgtype.Present}, &pgtype.Hstore{Map: map[string]pgtype.Text{"foo": text("NULL")}, Status: pgtype.Present}, &pgtype.Hstore{Map: map[string]pgtype.Text{"": text("bar")}, Status: pgtype.Present}, + &pgtype.Hstore{ + Map: map[string]pgtype.Text{"a": text("a"), "b": {Status: pgtype.Null}, "c": text("c"), "d": {Status: pgtype.Null}, "e": text("e")}, + Status: pgtype.Present, + }, &pgtype.Hstore{Status: pgtype.Null}, }