aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-08-19 17:31:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-08-19 17:31:56 +0000
commitf958310a85ba6e9c50c52ccf98ebd5425136931c (patch)
tree599f2f718f33cce2c8dffba332f762a4516d4aaf
parent075abb17875831a005ab4752b260ad0a532115bb (diff)
downloadpostgresql-f958310a85ba6e9c50c52ccf98ebd5425136931c.tar.gz
postgresql-f958310a85ba6e9c50c52ccf98ebd5425136931c.zip
Be a bit less cavalier with both the code and the comment for UNKNOWN fix.
-rw-r--r--src/pl/plpgsql/src/pl_exec.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index b1ab8299608..04067c176ea 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.244.2.8 2010/08/19 16:54:51 heikki Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.244.2.9 2010/08/19 17:31:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -5431,14 +5431,16 @@ exec_eval_using_params(PLpgSQL_execstate *estate, List *params)
if (ppd->types[i] == UNKNOWNOID)
{
/*
- * Treat 'unknown' parameters as text, that's what most people
- * would expect. The backend can coerce unknown constants in a
- * more intelligent way, but not unknown Params.
+ * Treat 'unknown' parameters as text, since that's what most
+ * people would expect. SPI_execute_with_args can coerce unknown
+ * constants in a more intelligent way, but not unknown Params.
+ * This code also takes care of copying into the right context.
+ * Note we assume 'unknown' has the representation of C-string.
*/
ppd->types[i] = TEXTOID;
if (!isnull)
{
- ppd->values[i] = CStringGetTextDatum((char *) ppd->values[i]);
+ ppd->values[i] = CStringGetTextDatum(DatumGetCString(ppd->values[i]));
ppd->freevals[i] = true;
}
}