aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeIndexscan.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-03-30 16:47:35 +0000
committerBruce Momjian <bruce@momjian.us>1998-03-30 16:47:35 +0000
commit9a0dd4fb183958f59f68d8a5f096dd8df18d9b59 (patch)
tree2843356dbd25f4e11cf4a414e56d6afae3775071 /src/backend/executor/nodeIndexscan.c
parentc579ce0fb03aaf92d184adf369cf13be013adf1b (diff)
downloadpostgresql-9a0dd4fb183958f59f68d8a5f096dd8df18d9b59.tar.gz
postgresql-9a0dd4fb183958f59f68d8a5f096dd8df18d9b59.zip
There's a patch attached to fix gcc 2.8.x warnings, except for the
yyerror ones from bison. It also includes a few 'enhancements' to the C programming style (which are, of course, personal). The other patch removes the compilation of backend/lib/qsort.c, as qsort() is a standard function in stdlib.h and can be used any where else (and it is). It was only used in backend/optimizer/geqo/geqo_pool.c, backend/optimizer/path/predmig.c, and backend/storage/page/bufpage.c > > Some or all of these changes might not be appropriate for v6.3, since we > > are in beta testing and since they do not affect the current functionality. > > For those cases, how about submitting patches based on the final v6.3 > > release? There's more to come. Please review these patches. I ran the regression tests and they only failed where this was expected (random, geo, etc). Cheers, Jeroen
Diffstat (limited to 'src/backend/executor/nodeIndexscan.c')
-rw-r--r--src/backend/executor/nodeIndexscan.c88
1 files changed, 36 insertions, 52 deletions
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index 8bce5762b26..74a36e45efa 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.16 1998/02/26 12:13:11 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.17 1998/03/30 16:46:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -91,7 +91,6 @@ IndexNext(IndexScan *node)
IndexScanDesc scandesc;
Relation heapRelation;
RetrieveIndexResult result;
- ItemPointer iptr;
HeapTuple tuple;
TupleTableSlot *slot;
Buffer buffer = InvalidBuffer;
@@ -116,58 +115,47 @@ IndexNext(IndexScan *node)
* ----------------
*/
- for (;;)
+ /* ----------------
+ * if scanning this index succeeded then return the
+ * appropriate heap tuple.. else return NULL.
+ * ----------------
+ */
+ while ((result = index_getnext(scandesc, direction)) != NULL)
{
- result = index_getnext(scandesc, direction);
- /* ----------------
- * if scanning this index succeeded then return the
- * appropriate heap tuple.. else return NULL.
- * ----------------
- */
- if (result)
- {
- iptr = &result->heap_iptr;
- tuple = heap_fetch(heapRelation,
- false,
- iptr,
- &buffer);
- /* be tidy */
- pfree(result);
-
- if (tuple == NULL)
- {
- /* ----------------
- * we found a deleted tuple, so keep on scanning..
- * ----------------
- */
- if (BufferIsValid(buffer))
- ReleaseBuffer(buffer);
- continue;
- }
+ tuple = heap_fetch(heapRelation, false, &result->heap_iptr, &buffer);
+ /* be tidy */
+ pfree(result);
+ if (tuple != NULL)
+ {
/* ----------------
- * store the scanned tuple in the scan tuple slot of
- * the scan state. Eventually we will only do this and not
- * return a tuple. Note: we pass 'false' because tuples
- * returned by amgetnext are pointers onto disk pages and
- * were not created with palloc() and so should not be pfree()'d.
- * ----------------
- */
+ * store the scanned tuple in the scan tuple slot of
+ * the scan state. Eventually we will only do this and not
+ * return a tuple. Note: we pass 'false' because tuples
+ * returned by amgetnext are pointers onto disk pages and
+ * were not created with palloc() and so should not be pfree()'d.
+ * ----------------
+ */
ExecStoreTuple(tuple, /* tuple to store */
- slot,/* slot to store in */
- buffer, /* buffer associated with tuple */
- false); /* don't pfree */
-
+ slot, /* slot to store in */
+ buffer, /* buffer associated with tuple */
+ false); /* don't pfree */
+
return slot;
}
-
- /* ----------------
- * if we get here it means the index scan failed so we
- * are at the end of the scan..
- * ----------------
- */
- return ExecClearTuple(slot);
+ else
+ {
+ if (BufferIsValid(buffer))
+ ReleaseBuffer(buffer);
+ }
}
+
+ /* ----------------
+ * if we get here it means the index scan failed so we
+ * are at the end of the scan..
+ * ----------------
+ */
+ return ExecClearTuple(slot);
}
/* ----------------------------------------------------------------
@@ -194,14 +182,11 @@ IndexNext(IndexScan *node)
TupleTableSlot *
ExecIndexScan(IndexScan *node)
{
- TupleTableSlot *returnTuple;
-
/* ----------------
* use IndexNext as access method
* ----------------
*/
- returnTuple = ExecScan(&node->scan, IndexNext);
- return returnTuple;
+ return ExecScan(&node->scan, IndexNext);
}
/* ----------------------------------------------------------------
@@ -377,7 +362,6 @@ ExecEndIndexScan(IndexScan *node)
{
if (scanKeys[i] != NULL)
pfree(scanKeys[i]);
-
}
/* ----------------