Skip to content

Commit 3d7feba

Browse files
committed
Be a bit less cavalier with both the code and the comment for UNKNOWN fix.
1 parent cc46c4e commit 3d7feba

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/pl/plpgsql/src/pl_exec.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.261.2.2 2010/08/19 16:54:48 heikki Exp $
11+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.261.2.3 2010/08/19 17:31:50 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -5516,14 +5516,16 @@ exec_eval_using_params(PLpgSQL_execstate *estate, List *params)
55165516
if (ppd->types[i] == UNKNOWNOID)
55175517
{
55185518
/*
5519-
* Treat 'unknown' parameters as text, that's what most people
5520-
* would expect. The backend can coerce unknown constants in a
5521-
* more intelligent way, but not unknown Params.
5519+
* Treat 'unknown' parameters as text, since that's what most
5520+
* people would expect. SPI_execute_with_args can coerce unknown
5521+
* constants in a more intelligent way, but not unknown Params.
5522+
* This code also takes care of copying into the right context.
5523+
* Note we assume 'unknown' has the representation of C-string.
55225524
*/
55235525
ppd->types[i] = TEXTOID;
55245526
if (!isnull)
55255527
{
5526-
ppd->values[i] = CStringGetTextDatum((char *) ppd->values[i]);
5528+
ppd->values[i] = CStringGetTextDatum(DatumGetCString(ppd->values[i]));
55275529
ppd->freevals[i] = true;
55285530
}
55295531
}

0 commit comments

Comments
 (0)