aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pl/plpgsql/src/pl_exec.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index d1a3a098dc2..1071521d23b 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.127.4.5 2006/01/17 17:33:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.127.4.6 2007/01/30 18:02:40 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -3930,16 +3930,23 @@ make_tuple_from_row(PLpgSQL_execstate *estate,
static char *
convert_value_to_string(Datum value, Oid valtype)
{
+ char *str;
Oid typoutput;
Oid typioparam;
bool typIsVarlena;
getTypeOutputInfo(valtype, &typoutput, &typioparam, &typIsVarlena);
- return DatumGetCString(OidFunctionCall3(typoutput,
- value,
- ObjectIdGetDatum(typioparam),
- Int32GetDatum(-1)));
+ SPI_push();
+
+ str = DatumGetCString(OidFunctionCall3(typoutput,
+ value,
+ ObjectIdGetDatum(typioparam),
+ Int32GetDatum(-1)));
+
+ SPI_pop();
+
+ return str;
}
/* ----------
@@ -3965,10 +3972,12 @@ exec_cast_value(Datum value, Oid valtype,
char *extval;
extval = convert_value_to_string(value, valtype);
+ SPI_push();
value = FunctionCall3(reqinput,
CStringGetDatum(extval),
ObjectIdGetDatum(reqtypioparam),
Int32GetDatum(reqtypmod));
+ SPI_pop();
pfree(extval);
}
}