summaryrefslogtreecommitdiff
path: root/src/backend/access/index/indexam.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-04-12 23:14:21 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-04-12 23:14:21 +0000
commitec498cdcbb7e7b430acc7236ab19ef70f116441a (patch)
tree48ab9fa79a3b9ac79f58a6079c28328243312f56 /src/backend/access/index/indexam.c
parent00832809a0fe271487d6851af72d0d88246a5d94 (diff)
downloadpostgresql-ec498cdcbb7e7b430acc7236ab19ef70f116441a.tar.gz
Create new routines systable_beginscan_ordered, systable_getnext_ordered,
systable_endscan_ordered that have API similar to systable_beginscan etc (in particular, the passed-in scankeys have heap not index attnums), but guarantee ordered output, unlike the existing functions. For the moment these are just very thin wrappers around index_beginscan/index_getnext/etc. Someday they might need to get smarter; but for now this is just a code refactoring exercise to reduce the number of direct callers of index_getnext, in preparation for changing that function's API. In passing, remove index_getnext_indexitem, which has been dead code for quite some time, and will have even less use than that in the presence of run-time-lossy indexes.
Diffstat (limited to 'src/backend/access/index/indexam.c')
-rw-r--r--src/backend/access/index/indexam.c48
1 files changed, 2 insertions, 46 deletions
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index d59f1529db..7a06d0074e 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.105 2008/04/10 22:25:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.106 2008/04/12 23:14:21 tgl Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relation OID
@@ -206,12 +206,7 @@ index_insert(Relation indexRelation,
/*
* index_beginscan - start a scan of an index with amgettuple
*
- * Note: heapRelation may be NULL if there is no intention of calling
- * index_getnext on this scan; index_getnext_indexitem will not use the
- * heapRelation link (nor the snapshot). However, the caller had better
- * be holding some kind of lock on the heap relation in any case, to ensure
- * no one deletes it (or the index) out from under us. Caller must also
- * be holding a lock on the index.
+ * Caller must be holding suitable locks on the heap and the index.
*/
IndexScanDesc
index_beginscan(Relation heapRelation,
@@ -635,45 +630,6 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
}
/* ----------------
- * index_getnext_indexitem - get the next index tuple from a scan
- *
- * Finds the next index tuple satisfying the scan keys. Note that the
- * corresponding heap tuple is not accessed, and thus no time qual (snapshot)
- * check is done, other than the index AM's internal check for killed tuples
- * (which most callers of this routine will probably want to suppress by
- * setting scan->ignore_killed_tuples = false).
- *
- * On success (TRUE return), the heap TID of the found index entry is in
- * scan->xs_ctup.t_self. scan->xs_cbuf is untouched.
- * ----------------
- */
-bool
-index_getnext_indexitem(IndexScanDesc scan,
- ScanDirection direction)
-{
- FmgrInfo *procedure;
- bool found;
-
- SCAN_CHECKS;
- GET_SCAN_PROCEDURE(amgettuple);
-
- /* just make sure this is false... */
- scan->kill_prior_tuple = false;
-
- /*
- * have the am's gettuple proc do all the work.
- */
- found = DatumGetBool(FunctionCall2(procedure,
- PointerGetDatum(scan),
- Int32GetDatum(direction)));
-
- if (found)
- pgstat_count_index_tuples(scan->indexRelation, 1);
-
- return found;
-}
-
-/* ----------------
* index_getbitmap - get all tuples at once from an index scan
*
* Adds the TIDs of all heap tuples satisfying the scan keys to a bitmap.