diff --git a/hstore.go b/hstore.go index 522813ff..56af38ee 100644 --- a/hstore.go +++ b/hstore.go @@ -297,13 +297,9 @@ func parseHstore(s string) (k []string, v []Text, err error) { case hsKey: switch r { case '"': //End of the key - if buf.Len() == 0 { - err = errors.New("Empty Key is invalid") - } else { - keys = append(keys, buf.String()) - buf = bytes.Buffer{} - state = hsSep - } + keys = append(keys, buf.String()) + buf = bytes.Buffer{} + state = hsSep case '\\': //Potential escaped character n, end := p.Consume() switch { diff --git a/hstore_test.go b/hstore_test.go index ccd476dc..ba6c9373 100644 --- a/hstore_test.go +++ b/hstore_test.go @@ -19,6 +19,7 @@ func TestHstoreTranscode(t *testing.T) { &pgtype.Hstore{Map: map[string]pgtype.Text{"foo": text("bar"), "baz": text("quz")}, Status: pgtype.Present}, &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{Status: pgtype.Null}, }