From 2a76aa23e08e1b3b44865ef30fd72c05ef155e11 Mon Sep 17 00:00:00 2001 From: "Vadim B. Mikheev" Date: Wed, 10 Mar 1999 12:16:09 +0000 Subject: [PATCH] We have to return dummy tuple for empty targetlist! Try select t1.x from t1, t2 where t1.y = 1 and t2.y = 1 - t2 scan target list will be empty and so no one tuple will be returned... --- src/backend/executor/execQual.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index b1d29f3d8e..87eeb83568 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.46 1999/02/23 07:33:44 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.47 1999/03/10 12:16:09 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -1474,10 +1474,15 @@ ExecTargetList(List *targetlist, * is this a new phenomenon? it might cause bogus behavior * if we try to free this tuple later!! I put a hook in * ExecProject to watch out for this case -mer 24 Aug 1992 + * + * We must return dummy tuple!!! Try + * select t1.x from t1, t2 where t1.y = 1 and t2.y = 1 + * - t2 scan target list will be empty and so no one tuple + * will be returned! But Mer was right - dummy tuple + * must be palloced... - vadim 03/01/1999 */ - CXT1_printf("ExecTargetList: context is %d\n", CurrentMemoryContext); *isDone = true; - return (HeapTuple) true; + return (HeapTuple) palloc(1); } /* @@ -1640,12 +1645,6 @@ ExecProject(ProjectionInfo *projInfo, bool *isDone) tupValue = projInfo->pi_tupValue; econtext = projInfo->pi_exprContext; - if (targetlist == NIL) - { - *isDone = true; - return (TupleTableSlot *) NULL; - } - /* * form a new (result) tuple */ -- 2.40.0