summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2000-10-22 19:19:42 +0000
committerTom Lane2000-10-22 19:19:42 +0000
commit6dee4ac84ce6382ce55a51ab519a1e37e00738f1 (patch)
treec1219f7ec1dc74fda8cb586f754e0052bd15517d
parentd11d8d0501e62d146017b9b79d2a4dec55e95603 (diff)
Fix to_char() to avoid coredump on NULL input. Not needed in current
sources due to fmgr rewrite, but 7.0.3 can use the patch...
-rw-r--r--src/backend/utils/adt/formatting.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 62369193234..0701b800672 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
* formatting.c
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.8.2.1 2000/10/19 18:39:03 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.8.2.2 2000/10/22 19:19:42 tgl Exp $
*
*
* Portions Copyright (c) 1999-2000, PostgreSQL, Inc
@@ -4006,6 +4006,9 @@ numeric_to_char(Numeric value, text *fmt)
*p;
Numeric x = NULL;
+ if (!value)
+ return textin("");
+
NUM_TOCHAR_prepare;
/* ----------
@@ -4089,7 +4092,7 @@ int4_to_char(int32 value, text *fmt)
plen = 0,
sign = 0;
char *numstr,
- *orgnum;
+ *orgnum;
NUM_TOCHAR_prepare;
@@ -4170,6 +4173,9 @@ int8_to_char(int64 *value, text *fmt)
char *numstr,
*orgnum;
+ if (!value)
+ return textin("");
+
NUM_TOCHAR_prepare;
/* ----------
@@ -4252,6 +4258,9 @@ float4_to_char(float32 value, text *fmt)
*orgnum,
*p;
+ if (!value)
+ return textin("");
+
NUM_TOCHAR_prepare;
if (IS_ROMAN(&Num))
@@ -4330,6 +4339,9 @@ float8_to_char(float64 value, text *fmt)
*orgnum,
*p;
+ if (!value)
+ return textin("");
+
NUM_TOCHAR_prepare;
if (IS_ROMAN(&Num))