1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-29 23:43:17 +03:00

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.
This commit is contained in:
Tom Lane
2009-09-11 19:17:04 +00:00
parent 680bf3268c
commit 8c5463a511
6 changed files with 15 additions and 13 deletions

View File

@@ -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);
}
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.104 2009/08/27 15:59:22 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.105 2009/09/11 19:17:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -85,8 +85,8 @@ static Point* lseg_interpt_internal(LSEG *l1, LSEG *l2);
#define RDELIM_C '>'
/* Maximum number of characters printed by pair_encode() */
/* ...+2+7 : 2 accounts for extra_float_digits max value */
#define P_MAXLEN (2*(DBL_DIG+2+7)+1)
/* ...+3+7 : 3 accounts for extra_float_digits max value */
#define P_MAXLEN (2*(DBL_DIG+3+7)+1)
/*