Skip to content

Commit 9665b5a

Browse files
committed
Don't reset extra_float_digits
In PostgreSQL ≤11 the extra_float_digits parameter controlled how many digits were used for floating point numbers. It was set here to ensure people didn't accidentally needlessly lose precision (in 78a464e it was set to 3. In 5941153 it was changed to 2 as people reported problems on PostgreSQL ≤8.4, see #199). Since PostgreSQL 12 it will always use maximum precision unless it's set to ≤0. We only support PostgreSQL ≥14 now, so we can just remove it here. Ref: https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-FLOAT Fixes #475 Fixes #1150 Fixes #1146
1 parent 5e89899 commit 9665b5a

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

conn_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,14 @@ localhost:*:*:*:pass_C
197197

198198
assertPassword := func(extra values, expected string) {
199199
o := values{
200-
"host": "localhost",
201-
"sslmode": "disable",
202-
"connect_timeout": "20",
203-
"user": "majid",
204-
"port": "5432",
205-
"extra_float_digits": "2",
206-
"dbname": "pqgotest",
207-
"client_encoding": "UTF8",
208-
"datestyle": "ISO, MDY",
200+
"host": "localhost",
201+
"sslmode": "disable",
202+
"connect_timeout": "20",
203+
"user": "majid",
204+
"port": "5432",
205+
"dbname": "pqgotest",
206+
"client_encoding": "UTF8",
207+
"datestyle": "ISO, MDY",
209208
}
210209
for k, v := range extra {
211210
o[k] = v

connector.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ func NewConnector(dsn string) (*Connector, error) {
5555
// * Explicitly passed connection information
5656
o["host"] = "localhost"
5757
o["port"] = "5432"
58-
// N.B.: Extra float digits should be set to 3, but that breaks
59-
// Postgres 8.4 and older, where the max is 2.
60-
o["extra_float_digits"] = "2"
6158
for k, v := range parseEnviron(os.Environ()) {
6259
o[k] = v
6360
}

0 commit comments

Comments
 (0)