aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/lib/pq/encode.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2019-06-08 18:00:10 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2019-06-08 18:00:10 -0700
commitec8fa56c95c90fb90925c723d7afd0d5fd642a76 (patch)
tree45b60eb64085a3f75ca9ee72095d510d68f7db10 /vendor/github.com/lib/pq/encode.go
parent91508c50b54c9a0375856a17b2e774d42782b81d (diff)
Update vendor folder
Diffstat (limited to 'vendor/github.com/lib/pq/encode.go')
-rw-r--r--vendor/github.com/lib/pq/encode.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/vendor/github.com/lib/pq/encode.go b/vendor/github.com/lib/pq/encode.go
index 3b0d365..a6902fa 100644
--- a/vendor/github.com/lib/pq/encode.go
+++ b/vendor/github.com/lib/pq/encode.go
@@ -117,11 +117,10 @@ func textDecode(parameterStatus *parameterStatus, s []byte, typ oid.Oid) interfa
}
return i
case oid.T_float4, oid.T_float8:
- bits := 64
- if typ == oid.T_float4 {
- bits = 32
- }
- f, err := strconv.ParseFloat(string(s), bits)
+ // We always use 64 bit parsing, regardless of whether the input text is for
+ // a float4 or float8, because clients expect float64s for all float datatypes
+ // and returning a 32-bit parsed float64 produces lossy results.
+ f, err := strconv.ParseFloat(string(s), 64)
if err != nil {
errorf("%s", err)
}