From a8487e15ed91c10bdbba1096c6e941c6ecb8b11a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 7 Oct 2004 18:38:51 +0000 Subject: Fix problems with SQL functions returning rowtypes that have dropped columns. The returned tuple needs to have appropriate NULL columns inserted so that it actually matches the declared rowtype. It seemed convenient to use a JunkFilter for this, so I made some cleanups and simplifications in the JunkFilter code to allow it to support this additional functionality. (That in turn exposed a latent bug in nodeAppend.c, which is that it was returning a tuple slot whose descriptor didn't match its data.) Also, move check_sql_fn_retval out of pg_proc.c and into functions.c, where it seems to more naturally belong. --- src/backend/executor/execMain.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/backend/executor/execMain.c') diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index ea9dce019b1..d000eb79627 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -26,7 +26,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.238 2004/09/13 20:06:46 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.239 2004/10/07 18:38:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -684,8 +684,8 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly) JunkFilter *j; j = ExecInitJunkFilter(subplan->plan->targetlist, - ExecGetResultType(subplan), - ExecAllocTableSlot(estate->es_tupleTable)); + resultRelInfo->ri_RelationDesc->rd_att->tdhasoid, + ExecAllocTableSlot(estate->es_tupleTable)); resultRelInfo->ri_junkFilter = j; resultRelInfo++; } @@ -703,7 +703,7 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly) JunkFilter *j; j = ExecInitJunkFilter(planstate->plan->targetlist, - tupType, + tupType->tdhasoid, ExecAllocTableSlot(estate->es_tupleTable)); estate->es_junkFilter = j; if (estate->es_result_relation_info) -- cgit v1.2.3