aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/src/sgml/config.sgml4
-rw-r--r--src/backend/utils/adt/float.c6
-rw-r--r--src/backend/utils/adt/geo_ops.c6
-rw-r--r--src/backend/utils/misc/guc.c4
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample2
-rw-r--r--src/bin/pg_dump/pg_dump.c6
6 files changed, 15 insertions, 13 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index c9603419ae4..f995b655b6b 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.226 2009/09/10 15:02:46 alvherre Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.227 2009/09/11 19:17:03 tgl Exp $ -->
<chapter Id="runtime-config">
<title>Server Configuration</title>
@@ -4291,7 +4291,7 @@ SET XML OPTION { DOCUMENT | CONTENT };
floating-point values, including <type>float4</>, <type>float8</>,
and geometric data types. The parameter value is added to the
standard number of digits (<literal>FLT_DIG</> or <literal>DBL_DIG</>
- as appropriate). The value can be set as high as 2, to include
+ as appropriate). The value can be set as high as 3, to include
partially-significant digits; this is especially useful for dumping
float data that needs to be restored exactly. Or it can be set
negative to suppress unwanted digits.
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);
}
}
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c
index dcc9656dfb4..59582f14104 100644
--- a/src/backend/utils/adt/geo_ops.c
+++ b/src/backend/utils/adt/geo_ops.c
@@ -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)
/*
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 608378cb4b7..cfa71e0cc11 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.516 2009/09/08 17:08:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.517 2009/09/11 19:17:03 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -1684,7 +1684,7 @@ static struct config_int ConfigureNamesInt[] =
"(FLT_DIG or DBL_DIG as appropriate).")
},
&extra_float_digits,
- 0, -15, 2, NULL, NULL
+ 0, -15, 3, NULL, NULL
},
{
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 4a361391f2c..b10775cc2df 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -445,7 +445,7 @@
# India
# You can create your own file in
# share/timezonesets/.
-#extra_float_digits = 0 # min -15, max 2
+#extra_float_digits = 0 # min -15, max 3
#client_encoding = sql_ascii # actually, defaults to database
# encoding
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index c5f97ca053c..5856dc7049a 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.546 2009/08/04 19:46:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.547 2009/09/11 19:17:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -595,7 +595,9 @@ main(int argc, char **argv)
* If supported, set extra_float_digits so that we can dump float data
* exactly (given correctly implemented float I/O code, anyway)
*/
- if (g_fout->remoteVersion >= 70400)
+ if (g_fout->remoteVersion >= 80500)
+ do_sql_command(g_conn, "SET extra_float_digits TO 3");
+ else if (g_fout->remoteVersion >= 70400)
do_sql_command(g_conn, "SET extra_float_digits TO 2");
/*