From 8c5463a51176c8d2a01fcf154d7ac33fa9a74f6a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 11 Sep 2009 19:17:04 +0000 Subject: Increase the maximum value of extra_float_digits to 3, and have pg_dump use that value when the backend is new enough to allow it. This responds to bug report from Keh-Cheng Chu pointing out that although 2 extra digits should be sufficient to dump and restore float8 exactly, it is possible to need 3 extra digits for float4 values. --- src/backend/utils/adt/float.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/utils/adt/float.c') diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c index 4547240be1f..d30fcc01632 100644 --- a/src/backend/utils/adt/float.c +++ b/src/backend/utils/adt/float.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.162 2009/06/11 14:49:03 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.163 2009/09/11 19:17:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -334,7 +334,7 @@ float4out(PG_FUNCTION_ARGS) if (ndig < 1) ndig = 1; - sprintf(ascii, "%.*g", ndig, num); + snprintf(ascii, MAXFLOATWIDTH + 1, "%.*g", ndig, num); } } @@ -523,7 +523,7 @@ float8out(PG_FUNCTION_ARGS) if (ndig < 1) ndig = 1; - sprintf(ascii, "%.*g", ndig, num); + snprintf(ascii, MAXDOUBLEWIDTH + 1, "%.*g", ndig, num); } } -- cgit v1.2.3