git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 49077e8)
Prevent core dump when ExecMarkPos is called before any tuples have been
2002年12月18日 00:14:24 +0000 (00:14 +0000)
2002年12月18日 00:14:24 +0000 (00:14 +0000)
retrieved. This cannot happen in ordinary execution, but it can happen
under EvalPlanQual().


diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index 7b96723844bd93f7450c6ad2e2a3df7f4831a1ad..a7cfce15b4cbee70ad136cc2b72ef78d588064b5 100644 (file)
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -8,7 +8,7 @@
*
*
* 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,10 +470,13 @@ ExecIndexMarkPos(IndexScanState *node)
int indexPtr;
indexPtr = node->iss_MarkIndexPtr = node->iss_IndexPtr;
- indexScanDescs = node->iss_ScanDescs;
- scanDesc = indexScanDescs[indexPtr];
+ if (indexPtr >= 0 && indexPtr < node->iss_NumIndices)
+ {
+ indexScanDescs = node->iss_ScanDescs;
+ scanDesc = indexScanDescs[indexPtr];
- index_markpos(scanDesc);
+ index_markpos(scanDesc);
+ }
}
/* ----------------------------------------------------------------
@@ -482,8 +485,6 @@ ExecIndexMarkPos(IndexScanState *node)
* old comments
* Restores scan position by restoring the current index.
* Returns nothing.
- *
- * XXX Assumes previously marked scan position belongs to current index
* ----------------------------------------------------------------
*/
void
@@ -494,10 +495,13 @@ ExecIndexRestrPos(IndexScanState *node)
int indexPtr;
indexPtr = node->iss_IndexPtr = node->iss_MarkIndexPtr;
- indexScanDescs = node->iss_ScanDescs;
- scanDesc = indexScanDescs[indexPtr];
+ if (indexPtr >= 0 && indexPtr < node->iss_NumIndices)
+ {
+ indexScanDescs = node->iss_ScanDescs;
+ scanDesc = indexScanDescs[indexPtr];
- index_restrpos(scanDesc);
+ index_restrpos(scanDesc);
+ }
}
/* ----------------------------------------------------------------
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /