Skip to content

Commit 2a76aa2

Browse files
committed
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...
1 parent f8f0efb commit 2a76aa2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/backend/executor/execQual.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.46 1999/02/23 07:33:44 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.47 1999/03/10 12:16:09 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1474,10 +1474,15 @@ ExecTargetList(List *targetlist,
14741474
* is this a new phenomenon? it might cause bogus behavior
14751475
* if we try to free this tuple later!! I put a hook in
14761476
* ExecProject to watch out for this case -mer 24 Aug 1992
1477+
*
1478+
* We must return dummy tuple!!! Try
1479+
* select t1.x from t1, t2 where t1.y = 1 and t2.y = 1
1480+
* - t2 scan target list will be empty and so no one tuple
1481+
* will be returned! But Mer was right - dummy tuple
1482+
* must be palloced... - vadim 03/01/1999
14771483
*/
1478-
CXT1_printf("ExecTargetList: context is %d\n", CurrentMemoryContext);
14791484
*isDone = true;
1480-
return (HeapTuple) true;
1485+
return (HeapTuple) palloc(1);
14811486
}
14821487

14831488
/*
@@ -1640,12 +1645,6 @@ ExecProject(ProjectionInfo *projInfo, bool *isDone)
16401645
tupValue = projInfo->pi_tupValue;
16411646
econtext = projInfo->pi_exprContext;
16421647

1643-
if (targetlist == NIL)
1644-
{
1645-
*isDone = true;
1646-
return (TupleTableSlot *) NULL;
1647-
}
1648-
16491648
/*
16501649
* form a new (result) tuple
16511650
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy