mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Prevent core dump when ExecMarkPos is called before any tuples have been
retrieved. This cannot happen in ordinary execution, but it can happen under EvalPlanQual().
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.75 2002/12/15 16:17:46 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.76 2002/12/18 00:14:24 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -470,11 +470,14 @@ ExecIndexMarkPos(IndexScanState *node)
|
|||||||
int indexPtr;
|
int indexPtr;
|
||||||
|
|
||||||
indexPtr = node->iss_MarkIndexPtr = node->iss_IndexPtr;
|
indexPtr = node->iss_MarkIndexPtr = node->iss_IndexPtr;
|
||||||
|
if (indexPtr >= 0 && indexPtr < node->iss_NumIndices)
|
||||||
|
{
|
||||||
indexScanDescs = node->iss_ScanDescs;
|
indexScanDescs = node->iss_ScanDescs;
|
||||||
scanDesc = indexScanDescs[indexPtr];
|
scanDesc = indexScanDescs[indexPtr];
|
||||||
|
|
||||||
index_markpos(scanDesc);
|
index_markpos(scanDesc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* ExecIndexRestrPos
|
* ExecIndexRestrPos
|
||||||
@ -482,8 +485,6 @@ ExecIndexMarkPos(IndexScanState *node)
|
|||||||
* old comments
|
* old comments
|
||||||
* Restores scan position by restoring the current index.
|
* Restores scan position by restoring the current index.
|
||||||
* Returns nothing.
|
* Returns nothing.
|
||||||
*
|
|
||||||
* XXX Assumes previously marked scan position belongs to current index
|
|
||||||
* ----------------------------------------------------------------
|
* ----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@ -494,11 +495,14 @@ ExecIndexRestrPos(IndexScanState *node)
|
|||||||
int indexPtr;
|
int indexPtr;
|
||||||
|
|
||||||
indexPtr = node->iss_IndexPtr = node->iss_MarkIndexPtr;
|
indexPtr = node->iss_IndexPtr = node->iss_MarkIndexPtr;
|
||||||
|
if (indexPtr >= 0 && indexPtr < node->iss_NumIndices)
|
||||||
|
{
|
||||||
indexScanDescs = node->iss_ScanDescs;
|
indexScanDescs = node->iss_ScanDescs;
|
||||||
scanDesc = indexScanDescs[indexPtr];
|
scanDesc = indexScanDescs[indexPtr];
|
||||||
|
|
||||||
index_restrpos(scanDesc);
|
index_restrpos(scanDesc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* ExecInitIndexScan
|
* ExecInitIndexScan
|
||||||
|
Reference in New Issue
Block a user