1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Fix for breakage of C-coded SRFs, from Joe Conway.

This commit is contained in:
Tom Lane
2002-08-30 19:56:49 +00:00
parent e2d156fa6e
commit 549928d99b
4 changed files with 31 additions and 5 deletions

View File

@@ -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;