Skip to content

Commit 8749b6c

Browse files
committed
execScan.c: in the end of scan projInfo->pi_slot must be
return, not a slot returned from access method (they have different TupleDesc and MergeJoin node was broken). nodeIndexscan.c: index_markpos()/index_restrpos() call index-specific mark/restr funcs and are in use now (instead of IndexScanMarkPosition()/ExecIndexRestrPos()).
1 parent 2c2b983 commit 8749b6c

File tree

2 files changed

+41
-28
lines changed

2 files changed

+41
-28
lines changed

src/backend/executor/execScan.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.6 1997/09/08 21:43:02 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.7 1998/02/26 12:13:09 vadim Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -104,11 +104,23 @@ ExecScan(Scan *node,
104104
/* ----------------
105105
* if the slot returned by the accessMtd contains
106106
* NULL, then it means there is nothing more to scan
107-
* so we just return the empty slot.
107+
* so we just return the empty slot...
108+
*
109+
* ... with invalid TupleDesc (not the same as in
110+
* projInfo->pi_slot) and break upper MergeJoin node.
111+
* New code below do what ExecProject() does. - vadim 02/26/98
108112
* ----------------
109113
*/
110114
if (TupIsNull(slot))
111-
return slot;
115+
{
116+
scanstate->cstate.cs_TupFromTlist = false;
117+
resultSlot = scanstate->cstate.cs_ProjInfo->pi_slot;
118+
return (TupleTableSlot *)
119+
ExecStoreTuple (NULL,
120+
resultSlot,
121+
InvalidBuffer,
122+
true);
123+
}
112124

113125
/* ----------------
114126
* place the current tuple into the expr context

src/backend/executor/nodeIndexscan.c

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.15 1998/02/26 04:31:26 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.16 1998/02/26 12:13:11 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -267,11 +267,11 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
267267
n_keys = numScanKeys[indexPtr];
268268
run_keys = (int *) runtimeKeyInfo[indexPtr];
269269
scan_keys = (ScanKey) scanKeys[indexPtr];
270-
270+
271271
/* it's possible in subselects */
272272
if (exprCtxt == NULL)
273273
exprCtxt = node->scan.scanstate->cstate.cs_ExprContext;
274-
274+
275275
for (j = 0; j < n_keys; j++)
276276
{
277277

@@ -410,12 +410,10 @@ ExecIndexMarkPos(IndexScan *node)
410410
indexScanDescs = indexstate->iss_ScanDescs;
411411
scanDesc = indexScanDescs[indexPtr];
412412

413-
/* ----------------
414-
* XXX access methods don't return marked positions so
415-
* ----------------
416-
*/
413+
#if 0
417414
IndexScanMarkPosition(scanDesc);
418-
return;
415+
#endif
416+
index_markpos (scanDesc);
419417
}
420418

421419
/* ----------------------------------------------------------------
@@ -441,7 +439,10 @@ ExecIndexRestrPos(IndexScan *node)
441439
indexScanDescs = indexstate->iss_ScanDescs;
442440
scanDesc = indexScanDescs[indexPtr];
443441

442+
#if 0
444443
IndexScanRestorePosition(scanDesc);
444+
#endif
445+
index_restrpos (scanDesc);
445446
}
446447

447448
/* ----------------------------------------------------------------
@@ -488,7 +489,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
488489
HeapScanDesc currentScanDesc;
489490
ScanDirection direction;
490491
int baseid;
491-
492+
492493
List *execParam = NULL;
493494

494495
/* ----------------
@@ -711,22 +712,22 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
711712
* it identifies the value to place in our scan key.
712713
* ----------------
713714
*/
714-
715+
715716
/* Life was so easy before ... subselects */
716-
if (((Param *) leftop)->paramkind == PARAM_EXEC)
717+
if ( ((Param *) leftop)->paramkind == PARAM_EXEC )
717718
{
718719
have_runtime_keys = true;
719720
run_keys[j] = LEFT_OP;
720-
execParam = lappendi(execParam, ((Param *) leftop)->paramid);
721+
execParam = lappendi (execParam, ((Param*) leftop)->paramid);
721722
}
722723
else
723724
{
724725
scanvalue = ExecEvalParam((Param *) leftop,
725-
scanstate->cstate.cs_ExprContext,
726+
scanstate->cstate.cs_ExprContext,
726727
&isnull);
727728
if (isnull)
728729
flags |= SK_ISNULL;
729-
730+
730731
run_keys[j] = NO_OP;
731732
}
732733
}
@@ -804,22 +805,22 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
804805
* it identifies the value to place in our scan key.
805806
* ----------------
806807
*/
807-
808+
808809
/* Life was so easy before ... subselects */
809-
if (((Param *) rightop)->paramkind == PARAM_EXEC)
810+
if ( ((Param *) rightop)->paramkind == PARAM_EXEC )
810811
{
811812
have_runtime_keys = true;
812813
run_keys[j] = RIGHT_OP;
813-
execParam = lappendi(execParam, ((Param *) rightop)->paramid);
814+
execParam = lappendi (execParam, ((Param*) rightop)->paramid);
814815
}
815816
else
816817
{
817818
scanvalue = ExecEvalParam((Param *) rightop,
818-
scanstate->cstate.cs_ExprContext,
819+
scanstate->cstate.cs_ExprContext,
819820
&isnull);
820821
if (isnull)
821822
flags |= SK_ISNULL;
822-
823+
823824
run_keys[j] = NO_OP;
824825
}
825826
}
@@ -989,13 +990,13 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
989990
indexstate->iss_ScanDescs = scanDescs;
990991

991992
indexstate->cstate.cs_TupFromTlist = false;
992-
993-
/*
994-
* if there are some PARAM_EXEC in skankeys then force index rescan on
995-
* first scan.
993+
994+
/*
995+
* if there are some PARAM_EXEC in skankeys then
996+
* force index rescan on first scan.
996997
*/
997-
((Plan *) node)->chgParam = execParam;
998-
998+
((Plan*) node)->chgParam = execParam;
999+
9991000
/* ----------------
10001001
* all done.
10011002
* ----------------

0 commit comments

Comments
 (0)