@@ -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 {
|
||||
|
||||
@@ -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},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user