*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.244.2.7 2010/08/09 18:50:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.244.2.8 2010/08/19 16:54:51 heikki Exp $
*
*-------------------------------------------------------------------------
*/
ppd->nulls[i] = isnull ? 'n' : ' ';
ppd->freevals[i] = false;
+ 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.
+ */
+ ppd->types[i] = TEXTOID;
+ if (!isnull)
+ {
+ ppd->values[i] = CStringGetTextDatum((char *) ppd->values[i]);
+ ppd->freevals[i] = true;
+ }
+ }
/* pass-by-ref non null values must be copied into plpgsql context */
- if (!isnull)
+ else if (!isnull)
{
int16 typLen;
bool typByVal;