diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 5671bb6830..fae865f3f2 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -1204,7 +1204,7 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("value %s out of bounds for option \"%s\"",
 									value, option->gen->name),
-							 errdetail("Valid values are between \"%f\" and \"%f\".",
+							 errdetail("Valid values are between \"%g\" and \"%g\".",
 									   optreal->min, optreal->max)));
 			}
 			break;
diff --git a/src/test/regress/expected/btree_index.out b/src/test/regress/expected/btree_index.out
index 1ad33190a2..628d9be91b 100644
--- a/src/test/regress/expected/btree_index.out
+++ b/src/test/regress/expected/btree_index.out
@@ -165,7 +165,7 @@ select reloptions from pg_class WHERE oid = 'btree_idx1'::regclass;
 -- Fail while setting improper values
 create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = -10.0);
 ERROR:  value -10.0 out of bounds for option "vacuum_cleanup_index_scale_factor"
-DETAIL:  Valid values are between "0.000000" and "179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000".
+DETAIL:  Valid values are between "0" and "1.79769e+308".
 create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = 100.0);
 create index btree_idx_err on btree_test(a) with (vacuum_cleanup_index_scale_factor = 'string');
 ERROR:  invalid value for floating point option "vacuum_cleanup_index_scale_factor": string
diff --git a/src/test/regress/expected/reloptions.out b/src/test/regress/expected/reloptions.out
index df3c99d1eb..636151d4a4 100644
--- a/src/test/regress/expected/reloptions.out
+++ b/src/test/regress/expected/reloptions.out
@@ -16,10 +16,10 @@ ERROR:  value 110 out of bounds for option "fillfactor"
 DETAIL:  Valid values are between "10" and "100".
 CREATE TABLE reloptions_test2(i INT) WITH (autovacuum_analyze_scale_factor = -10.0);
 ERROR:  value -10.0 out of bounds for option "autovacuum_analyze_scale_factor"
-DETAIL:  Valid values are between "0.000000" and "100.000000".
+DETAIL:  Valid values are between "0" and "100".
 CREATE TABLE reloptions_test2(i INT) WITH (autovacuum_analyze_scale_factor = 110.0);
 ERROR:  value 110.0 out of bounds for option "autovacuum_analyze_scale_factor"
-DETAIL:  Valid values are between "0.000000" and "100.000000".
+DETAIL:  Valid values are between "0" and "100".
 -- Fail when option and namespace do not exist
 CREATE TABLE reloptions_test2(i INT) WITH (not_existing_option=2);
 ERROR:  unrecognized parameter "not_existing_option"
