|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.264 2010/08/1916:54:43heikki Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.265 2010/08/1917:31:43tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -5524,14 +5524,16 @@ exec_eval_using_params(PLpgSQL_execstate *estate, List *params)
|
5524 | 5524 | if (ppd->types[i]==UNKNOWNOID)
|
5525 | 5525 | {
|
5526 | 5526 | /*
|
5527 |
| - * Treat 'unknown' parameters as text, that's what most people |
5528 |
| - * would expect. The backend can coerce unknown constants in a |
5529 |
| - * more intelligent way, but not unknown Params. |
| 5527 | + * Treat 'unknown' parameters as text, since that's what most |
| 5528 | + * people would expect. SPI_execute_with_args can coerce unknown |
| 5529 | + * constants in a more intelligent way, but not unknown Params. |
| 5530 | + * This code also takes care of copying into the right context. |
| 5531 | + * Note we assume 'unknown' has the representation of C-string. |
5530 | 5532 | */
|
5531 | 5533 | ppd->types[i]=TEXTOID;
|
5532 | 5534 | if (!isnull)
|
5533 | 5535 | {
|
5534 |
| -ppd->values[i]=CStringGetTextDatum((char*)ppd->values[i]); |
| 5536 | +ppd->values[i]=CStringGetTextDatum(DatumGetCString(ppd->values[i])); |
5535 | 5537 | ppd->freevals[i]= true;
|
5536 | 5538 | }
|
5537 | 5539 | }
|
|