diff options
Diffstat (limited to 'src/include/access/relscan.h')
-rw-r--r-- | src/include/access/relscan.h | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h index 65ac7721660..87e3b523696 100644 --- a/src/include/access/relscan.h +++ b/src/include/access/relscan.h @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * relscan.h - * POSTGRES internal relation scan descriptor definitions. + * POSTGRES relation scan descriptor definitions. * * * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: relscan.h,v 1.25 2001/11/05 17:46:31 momjian Exp $ + * $Id: relscan.h,v 1.26 2002/05/20 23:51:43 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,42 +19,54 @@ typedef struct HeapScanDescData { - Relation rs_rd; /* pointer to relation descriptor */ + /* scan parameters */ + Relation rs_rd; /* heap relation descriptor */ + Snapshot rs_snapshot; /* snapshot to see */ + int rs_nkeys; /* number of scan keys */ + ScanKey rs_key; /* array of scan key descriptors */ + + /* scan current state */ HeapTupleData rs_ctup; /* current tuple in scan, if any */ Buffer rs_cbuf; /* current buffer in scan, if any */ /* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */ - ItemPointerData rs_mctid; /* marked tid, if any */ - Snapshot rs_snapshot; /* snapshot to see */ - uint16 rs_nkeys; /* number of scan keys to select tuples */ - ScanKey rs_key; /* key descriptors */ + ItemPointerData rs_mctid; /* marked scan position, if any */ PgStat_Info rs_pgstat_info; /* statistics collector hook */ } HeapScanDescData; typedef HeapScanDescData *HeapScanDesc; + typedef struct IndexScanDescData { - Relation relation; /* relation descriptor */ + /* scan parameters */ + Relation heapRelation; /* heap relation descriptor, or NULL */ + Relation indexRelation; /* index relation descriptor */ + Snapshot xs_snapshot; /* snapshot to see */ + int numberOfKeys; /* number of scan keys */ + ScanKey keyData; /* array of scan key descriptors */ + + /* scan current state */ void *opaque; /* access-method-specific info */ ItemPointerData currentItemData; /* current index pointer */ - ItemPointerData currentMarkData; /* marked current pointer */ - uint8 flags; /* scan position flags */ - bool scanFromEnd; /* restart scan at end? */ - uint16 numberOfKeys; /* number of scan keys to select tuples */ - ScanKey keyData; /* key descriptors */ - FmgrInfo fn_getnext; /* cached lookup info for am's getnext fn */ + ItemPointerData currentMarkData; /* marked position, if any */ + /* + * 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. + */ + 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 */ + + FmgrInfo fn_getnext; /* cached lookup info for AM's getnext fn */ PgStat_Info xs_pgstat_info; /* statistics collector hook */ } IndexScanDescData; typedef IndexScanDescData *IndexScanDesc; -/* IndexScanDesc flag bits (none of these are actually used currently) */ -#define ScanUnmarked 0x01 -#define ScanUncheckedPrevious 0x02 -#define ScanUncheckedNext 0x04 - /* ---------------- * IndexScanDescPtr is used in the executor where we have to |