aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execMain.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-01-08 23:32:29 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-01-08 23:32:29 +0000
commit3bb248ac2321252e624b04cc39b188b41c5d5fa3 (patch)
treef0bf0bd57e8488c46b61711d705e81e8c6f94aef /src/backend/executor/execMain.c
parentb56af49849f3f4f1aa95f31a74dc7ff3a14b575a (diff)
downloadpostgresql-3bb248ac2321252e624b04cc39b188b41c5d5fa3.tar.gz
postgresql-3bb248ac2321252e624b04cc39b188b41c5d5fa3.zip
Guard against stopping when numberTuples=0 and counter wraps around.
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r--src/backend/executor/execMain.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index f184265c491..613a62c3c37 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.195 2002/12/18 00:14:47 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.196 2003/01/08 23:32:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -166,7 +166,7 @@ ExecutorStart(QueryDesc *queryDesc)
* except to start up/shut down the destination. Otherwise,
* we retrieve up to 'count' tuples in the specified direction.
*
- * Note: count = 0 is interpreted as no portal limit, e.g. run to
+ * Note: count = 0 is interpreted as no portal limit, i.e., run to
* completion.
*
* ----------------------------------------------------------------
@@ -846,6 +846,7 @@ ExecEndPlan(PlanState *planstate, EState *estate)
*
* processes the query plan to retrieve 'numberTuples' tuples in the
* direction specified.
+ *
* Retrieves all tuples if numberTuples is 0
*
* result is either a slot containing the last tuple in the case
@@ -1091,10 +1092,10 @@ lnext: ;
/*
* check our tuple count.. if we've processed the proper number
* then quit, else loop again and process more tuples. Zero
- * number_tuples means no limit.
+ * numberTuples means no limit.
*/
current_tuple_count++;
- if (numberTuples == current_tuple_count)
+ if (numberTuples && numberTuples == current_tuple_count)
break;
}