mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
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.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/genam.h,v 1.70 2008/04/10 22:25:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/genam.h,v 1.71 2008/04/12 23:14:21 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -108,8 +108,6 @@ extern void index_endscan(IndexScanDesc scan);
|
||||
extern void index_markpos(IndexScanDesc scan);
|
||||
extern void index_restrpos(IndexScanDesc scan);
|
||||
extern HeapTuple index_getnext(IndexScanDesc scan, ScanDirection direction);
|
||||
extern bool index_getnext_indexitem(IndexScanDesc scan,
|
||||
ScanDirection direction);
|
||||
extern int64 index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap);
|
||||
|
||||
extern IndexBulkDeleteResult *index_bulk_delete(IndexVacuumInfo *info,
|
||||
@@ -140,5 +138,12 @@ extern SysScanDesc systable_beginscan(Relation heapRelation,
|
||||
int nkeys, ScanKey key);
|
||||
extern HeapTuple systable_getnext(SysScanDesc sysscan);
|
||||
extern void systable_endscan(SysScanDesc sysscan);
|
||||
extern SysScanDesc systable_beginscan_ordered(Relation heapRelation,
|
||||
Relation indexRelation,
|
||||
Snapshot snapshot,
|
||||
int nkeys, ScanKey key);
|
||||
extern HeapTuple systable_getnext_ordered(SysScanDesc sysscan,
|
||||
ScanDirection direction);
|
||||
extern void systable_endscan_ordered(SysScanDesc sysscan);
|
||||
|
||||
#endif /* GENAM_H */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.62 2008/04/10 22:25:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.63 2008/04/12 23:14:21 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -76,14 +76,12 @@ typedef struct IndexScanDescData
|
||||
/* index access method's private state */
|
||||
void *opaque; /* access-method-specific info */
|
||||
|
||||
/*
|
||||
* xs_ctup/xs_cbuf are valid after a successful index_getnext. After
|
||||
* index_getnext_indexitem, xs_ctup.t_self contains the heap tuple TID
|
||||
* from the index entry, but its other fields are not valid.
|
||||
*/
|
||||
/* xs_ctup/xs_cbuf are valid after a successful index_getnext */
|
||||
HeapTupleData xs_ctup; /* current heap tuple, if any */
|
||||
Buffer xs_cbuf; /* current heap buffer in scan, if any */
|
||||
/* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
|
||||
|
||||
/* state data for traversing HOT chains in index_getnext */
|
||||
TransactionId xs_prev_xmax; /* previous HOT chain member's XMAX, if any */
|
||||
OffsetNumber xs_next_hot; /* next member of HOT chain, if any */
|
||||
bool xs_hot_dead; /* T if all members of HOT chain are dead */
|
||||
|
||||
Reference in New Issue
Block a user