diff options
Diffstat (limited to 'src/backend/utils')
| -rw-r--r-- | src/backend/utils/fmgr/funcapi.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c index 35ba972fe1..0df872cf92 100644 --- a/src/backend/utils/fmgr/funcapi.c +++ b/src/backend/utils/fmgr/funcapi.c @@ -7,7 +7,7 @@ * Copyright (c) 2002, PostgreSQL Global Development Group * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/funcapi.c,v 1.4 2002/08/29 17:14:33 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/funcapi.c,v 1.5 2002/08/30 19:56:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -83,8 +83,16 @@ per_MultiFuncCall(PG_FUNCTION_ARGS) { FuncCallContext *retval = (FuncCallContext *) fcinfo->flinfo->fn_extra; - /* make sure we start with a fresh slot */ - if(retval->slot != NULL) + /* + * Clear the TupleTableSlot, if present. This is for safety's sake: + * the Slot will be in a long-lived context (it better be, if the + * FuncCallContext is pointing to it), but in most usage patterns the + * tuples stored in it will be in the function's per-tuple context. + * So at the beginning of each call, the Slot will hold a dangling + * pointer to an already-recycled tuple. We clear it out here. (See + * also the definition of TupleGetDatum() in funcapi.h!) + */ + if (retval->slot != NULL) ExecClearTuple(retval->slot); return retval; |
