diff --git a/postgres.go b/postgres.go index b8722bac..98068536 100644 --- a/postgres.go +++ b/postgres.go @@ -112,7 +112,12 @@ func (h Hstore) Value() (driver.Value, error) { } for key, value := range h { - hstore.Map[key] = sql.NullString{String: *value, Valid: true} + var s sql.NullString + if value != nil { + s.String = *value + s.Valid = true + } + hstore.Map[key] = s } return hstore.Value() }